title: PHP Mailer - Internal Server Error
body: <p>I have been trying to make the contact form on my website to work and I've spent weeks trying to figure it out and I couldn't.</p>
  
  <p>Here's the problem - I purchased a web template and it came with the PHPMailer. I'm now done plugging my content into the template, but the contact form has been a pain. I've followed the instructions the best I know on the PHP file, but it's giving me an "Internal Server Error" when I am testing the contact form.</p>
  
  <p>Here's the code that came with my purchase:</p>
  
  <p>
  
  <pre><code>$name = trim($_POST['name']);
  $email = $_POST['email'];
  $subject = $_POST['subject'];
  $message = $_POST['message'];
  
  $site_owners_email = 'name@mydomain.com'; // Replace this with your own email address
  $site_owners_name = 'My Name'; // Replace with your name
  
  try {
      require_once('/Beta-BRC/php/PHPMailer/class.phpmailer.php');
      $mail = new PHPMailer();
      $mail-&gt;CharSet = 'UTF-8';
  
      $mail-&gt;From = $email;
      $mail-&gt;FromName = $name;
      $mail-&gt;Subject = "[WEB Form] ".$subject;
      $mail-&gt;AddAddress($site_owners_email, $site_owners_name);
      $mail-&gt;Body = $message;
  
      $mail-&gt;Mailer = "smtp";
      $mail-&gt;Host = "smtp.gmail.com"; // Replace with your SMTP server address
      $mail-&gt;Port = 465;
      $mail-&gt;SMTPSecure = "SSL"; 
  
      $mail-&gt;SMTPAuth = true; // Turn on SMTP authentication
      $mail-&gt;Username = "name@mydomain.com"; // SMTP username
      $mail-&gt;Password = "mypassword"; // SMTP password
  
      //echo "true";
      if($mail-&gt;Send()) {
          echo "true";
      } else {
          echo "Error sending: " . $mail-&gt;ErrorInfo;
      }
  
  } catch (Exception $e) {
      echo $e;
  } 
  </code></pre>
  
  <p>Quick note - I've alrealy tried using a GMAIL account on this part but it still does not work.</p>
  
  <pre><code>$mail-&gt;Username = "name@mydomain.com"; // SMTP username
  $mail-&gt;Password = "mypassword"; // SMTP password
  </code></pre>