title: How to use PHPMailer without composer?
body: <p>I'd like to use the latest <a href="https://github.com/PHPMailer/PHPMailer" rel="noreferrer">PHPMailer</a> library with <code>require_once()</code> instead of messing around with Composer. I'd like a pure xcopy deployment with minimal fuss.</p>
  
  <p>Here's what I'm attempting to do:</p>
  
  <pre><code>require_once("src/PHPMailer.php");
  $mail = new PHPMailer;
  $mail-&gt;isSMTP(); 
  $mail-&gt;SMTPDebug = 2;
  $mail-&gt;Host = "smtp.gmail.com"; 
  $mail-&gt;Port = 587;
  $mail-&gt;SMTPSecure = 'tls';
  $mail-&gt;SMTPAuth = true;
  $mail-&gt;Username = $smtpUsername;
  $mail-&gt;Password = $smtpPassword;
  $mail-&gt;setFrom($emailFrom, $emailFromName);
  $mail-&gt;addAddress($emailTo, $emailToName);
  $mail-&gt;Subject = 'PHPMailer GMail SMTP test';
  $mail-&gt;msgHTML("test body"); 
  $mail-&gt;AltBody = 'HTML messaging not supported';
  
  if(!$mail-&gt;send()){
      echo "Mailer Error: " . $mail-&gt;ErrorInfo;
  }else{
      echo "Message sent!";
  }
  </code></pre>
  
  <p>I get the error message: <code>Fatal error: Class PHPMailer not found in [....]\EmailTester.php on line 21</code></p>
  
  <p>Line 21 is this: <code>$mail = new PHPMailer;</code></p>
  
  <p>This line is just a guess on my part: <code>require_once("src/PHPMailer.php");</code> - clearly I need to include some file or files, but I can't tell which.</p>
  
  <p>I'm working from the <a href="https://github.com/PHPMailer/PHPMailer/blob/master/examples/gmail.phps" rel="noreferrer">gmail example on github</a> which is also not included in the zip download. But I can navigate to it in github. In that example file it begins like this:</p>
  
  <pre><code>use PHPMailer\PHPMailer\PHPMailer;
  require '../vendor/autoload.php';
  $mail = new PHPMailer;
  </code></pre>
  
  <p>I see no <code>autoload.php</code> file in the zip download, and after googling all over I see this implies using Composer. But there must be some way to simply do an include and get the files I need.</p>
  
  <p>A few things puzzle me about this PHPMailer library and perhaps <strong>github</strong> in general:</p>
  
  <ol>
  <li>When I download PHP Mailer from GitHub, why are so many listed files and folders not included in the downloaded zip file?</li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/XhOoc.png" rel="noreferrer"><img src="https://i.stack.imgur.com/XhOoc.png" alt="enter image description here"></a></p>
  
  <ol start="2">
  <li>Why do they reference <code>autoload.php</code> which doesn't exist in the zip download?</li>
  <li>Clearly I don't understand some things about github, but why not provide a working code sample instead of referencing dependencies that don't exist in the download, forcing people to find it elsewhere and hope they can figure out how to come back and plug it in correctly?</li>
  <li>In this YouTube video titled <a href="https://www.youtube.com/watch?v=U13smZvdArI" rel="noreferrer">Send Emails with PHP &amp; Gmail</a>, he downloads the same zip I downloaded and from the same place, yet his zip contains different files, including <code>PHPMailerAutoload.php</code>. Why am I getting completely different files than he gets? That video was published March 4, 2017 -- so, less than 1 year ago -- has it really changed so much since then?</li>
  </ol>
  
  <p>In summary: How can I get PHPMailer working without external dependencies and installations such as <em>Composer</em>, and instead use <code>require_once()</code> to get what I need?</p>