title: Mail send with PHPMailer doesn't work
body: <p>So I'm trying to use PHPMailer to handle the email form on my website.</p>
  
  <p>I wrote the code here based on a tutorial I found.</p>
  
  <pre><code>&lt;?php
          error_reporting(E_ALL);
          require_once("class.phpmailer.php");
          include("class.smtp.php");
  
          $email = new PHPMailer();
  
          //
          // Set server details for send
          //
          $email-&gt;IsSMTP();
          $email-&gt;Host = "mail.loganyoung.za.net";
          $email-&gt;Port = 25;
          $email-SMTPAuth = true;
          $email-&gt;Username = "&lt;my email&gt;";
          $email-&gt;Password = "&lt;my password&gt;";
  
          //
          // Send mail from the contact form
          //
          $to = "&lt;my email&gt;";
          $from = $_POST["from"];
          $name = $_POST["name"];
          $subject = "From web: ".$_POST["subject"];
          $message = $_POST["message"];
  
          $body = "&lt;p&gt;Hi Logan,&lt;/p&gt;";
          $body .= "&lt;p&gt;You have received a new query on your website.&lt;br /&gt;Please see below:&lt;/p&gt;";
          $body .= "&lt;p&gt;";
          $body .= str_replace("\r\n", "&lt;br /&gt;", $message);
          $body .= "&lt;/p&gt;";
  
          $email-&gt;SetFrom($from, $name);
          $email-&gt;AddReplyTo($from, $name);
          $email-&gt;AddAddress($to, "LoganYoung.za.net");
          $email-&gt;Subject = $subject;
          $email-&gt;Body = $body;
          $email-&gt;IsHTML = true;
  
          session_start();
          if(!$email-&gt;Send()) {          
                  $_SESSION["mailresult"] = "success";
                  echo "success";
          } else {
                  echo "&lt;p&gt;Failed:&lt;/p&gt;&lt;p&gt;".$email-&gt;ErrorInfo."&lt;/p&gt;";
                  $_SESSION["mailresult"] = "failed";
                  $_SESSION["mailerror"] = $email-&gt;ErrorInfo;
          }
  
  ?&gt;
  </code></pre>
  
  <p>I figure possible reasons for it not sending could be...</p>
  
  <ul>
  <li>Incorrect SMTP details (possibly send without SMTP auth to resolve?)</li>
  <li>Handler isn't getting POST data (the ajax that sends it seems to work fine though)</li>
  <li>Some problem with this code that I'm not able to identify...</li>
  </ul>
  
  <p>As a means of eliminating possibilities, can anyone spot anything wrong with the code here? If so, what's wrong, and how do I fix it?</p>
  
  <p>Thanks in advance!</p>