title: PHPMailer SMTP connection error
body: <p>I've been trying to figure out how to get <code>phpMailer</code> to work for the last few hours. I keep getting errors. Here is my code:</p>
  
  <pre><code>&lt;?php
  $name = $_REQUEST['name'] ;
  $email = $_REQUEST['email'] ;
  $message = $_REQUEST['message'] ;
  
  require("class.phpmailer.php");
  $mail = new PHPMailer(); 
  $mail-&gt;IsSMTP(); // send via SMTP
  $mail-&gt;SMTPAuth = true; // turn on SMTP authentication
  $mail-&gt;Username = "******@gmail.com"; // SMTP username
  $mail-&gt;Password = "******"; // SMTP password
  $host = "smtp.mandrillapp.com";
  $port = 587;
  $mail-&gt;SMTPSecure = 'ssl';  
  $mail-&gt;SMTPDebug = 1;
  $webmaster_email = "****@gmail.com"; //Reply to this email ID
  $email= $email; // Recipients email ID
  $name= $name; // Recipient's name
  $mail-&gt;From = $webmaster_email;
  $mail-&gt;FromName = "University of Life Experiences";
  $mail-&gt;AddAddress($email,$name);
  $mail-&gt;AddReplyTo($webmaster_email,"Webmaster");
  $mail-&gt;WordWrap = 50; // set word wrap
  $mail-&gt;IsHTML(true); // send as HTML
  $mail-&gt;Subject = "ULE";
  $mail-&gt;Body = $message; //HTML Body
  $mail-&gt;AltBody = $message; //Text Body
  if(!$mail-&gt;Send())
  {
  echo "Mailer Error: " . $mail-&gt;ErrorInfo;
  }
  else
  {
  echo "Message has been sent";
  }
  ?&gt;
  </code></pre>
  
  <p>Here is the error I have been receiving:</p>
  
  <blockquote>
    <p>SMTP ERROR: Failed to connect to server: (0) SMTP connect() failed. Mailer Error: SMTP connect() failed.</p>
  </blockquote>
  
  <p>I have tried many different SMTP servers including Gmail and I always get a similar error about failing to connect.</p>
  
  <p>Please help, I have tried many other <code>phpMailer</code> example codes all with the same issue. If anyone can recommend any other PHP mailing programs that would be useful. The reason I am not using the inbuilt <code>mail()</code> function.</p>