title: Sending an email using PHPMailer and GMAIL SMTP
body: <p>I have read every example out in the web and I still cant seem to connect to the GMAIL SMTP. Here is the code that I am running:</p>
  
  <pre><code>include("phpMailer/class.phpmailer.php"); // path to the PHPMailer class
  $mail = new PHPMailer(); 
  $mail-&gt;IsSMTP(); // send via SMTP
  
  $mail-&gt;SMTPAuth = true; // turn on SMTP authentication
  $mail-&gt;Username = "myUsername"; // SMTP username
  $mail-&gt;Password = "myPassword"; // SMTP password
  $mail-&gt;SMTPDebug = 1;
  $webmaster_email = "webMasterEmail@gmail.com"; //Reply to this email ID
  $email="someone@gmail.com"; // Recipients email ID
  $name="SomeonesName"; // Recipient's name
  $mail-&gt;From = $webmaster_email;
  $mail-&gt;FromName = "Me";
  $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 = "This is the subject";
  $mail-&gt;Body = "Hi,
  This is the HTML BODY "; //HTML Body
  $mail-&gt;AltBody = "This is the body when user views in plain text format"; //Text Body
  if(!$mail-&gt;Send())
  {
      echo "Mailer Error: " . $mail-&gt;ErrorInfo;
  }
  else
  {
      echo "Message has been sent";
  }
  </code></pre>
  
  <p>I tried setting the port in here and I also have the current set up with the following in the class.smtp.php file:</p>
  
  <pre><code>$host = "ssl://smtp.gmail.com";
  $port = 465;
  </code></pre>
  
  <p>I keep getting the same error and I have made sure that ssl is enabled. The error I get is:</p>
  
  <pre class="lang-none prettyprint-override"><code>SMTP -&gt; ERROR: Failed to connect to server: No connection could be made because the target machine actively refused it.(10061)
  </code></pre>