title: PHPmailer - 500 internal server error
body: <p>I keep on having the 500 internal sever error with my web hosted by GoDaddy, using the PHPmailer; I've tried several solutions available on StackOverflow relating to my challenge, but none of them worked.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>require 'phpmailer/PHPMailerAutoload.php';
  $feedback='';
  $flag = array();
  if(isset($_POST["submitlogin"]) and $_SERVER['REQUEST_METHOD'] == "POST"){
  
      $name = seo_friendly_url($_POST['name']);
      $email = seo_friendly_url($_POST['email']);
      $subject = seo_friendly_url($_POST['subject']);
      $message = seo_friendly_url($_POST['message']);
  
      //Email
  
      if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$email)) {
          $feedback="Invalid email format";
          array_push($flag,"false");
      }else {
          array_push($flag,"true");
      }
      //Email 
  
      //Name
      if (preg_match('/^[-a-zA-Z0-9._]+$/', $name)){  
          array_push($flag,"true");
      }else {
          $feedback="Invalid name format";
          array_push($flag,"false");
      }
      //Name
  
  
      if (!in_array("false", $flag)) {
  
          //SMTP needs accurate times, and the PHP time zone MUST be set
          //This should be done in your php.ini, but this is how to do it if you don't have access to that
          date_default_timezone_set('Etc/UTC');
  
          //Create a new PHPMailer instance
          $mail = new PHPMailer;
          //Tell PHPMailer to use SMTP
          $mail-&gt;isSMTP();
          //Enable SMTP debugging
          // 0 = off (for production use)
          // 1 = client messages
          // 2 = client and server messages
          $mail-&gt;SMTPDebug = 2;
          //Ask for HTML-friendly debug output
          $mail-&gt;Debugoutput = 'html';
          //Set the hostname of the mail server
          $mail-&gt;Host = "smtpout.asia.secureserver.net";
          //Set the SMTP port number - likely to be 25, 465 or 587
          $mail-&gt;Port = 25;
          //Whether to use SMTP authentication
          //$mail-&gt;Username = 'email@email.com'; 
          //$mail-&gt;Password = 'password'; 
          $mail-&gt;SMTPAuth = false;
          //Set who the message is to be sent from
          $mail-&gt;setFrom('email@email.com');
          //Set an alternative reply-to address
          $mail-&gt;addReplyTo($email);
          //Set who the message is to be sent to
          $mail-&gt;addAddress('email@email.com');     // Add a recipient
          $mail-&gt;addAddress('email@email.com');
          $mail-&gt;addAddress('email@email.com);
          //Set the subject line
          $mail-&gt;Subject = 'HLS Inquiry';
          //Read an HTML message body from an external file, convert referenced images to embedded,
          //convert HTML into a basic plain-text alternative body
          $mail-&gt;msgHTML($message);
  
  
  
  
  
  
  
          $email_ar = $email;
          $subject_ar = $name.", Thank you for your Inquiry"; 
          $acknowledgement_receipt = '
              &lt;div style="padding:10px 20px;font-size:16px;"&gt;
  
                  &lt;p&gt;Dear '.$name.',&lt;/p&gt;
  
                  &lt;p&gt;We&amp;#39;ve received your message and would like to thank you for contacting us. We will reply by email shortly.&lt;/p&gt;
  
                  &lt;p&gt;Talk to you soon,&lt;/p&gt;
  
                  &lt;p&gt;
                      &lt;div&gt;Customer Service&lt;/div&gt;
  
                  &lt;/p&gt;
  
              &lt;/div&gt;
          ';
  
  
  
          if ($mail-&gt;send()) {
              $feedback = "&lt;span style='color:green;'&gt;Thank you for your inquiry. We will respond to you within 24 hours.&lt;/span&gt;";
          } 
  
  }
  </code></pre>
  
  <p>Please note that I replaced some of the email values as: <code>email@email.com</code> for my privacy.</p>
  
  <p>I believed that the email setups are correct because I already used those setups from my friend's website hosted by JustHost.</p>