title: phpmailer : Could not connect to SMTP host
body: <p>This is sample code from phpmailer file. I edit some of code and it gives me error. i tried to change port number as well but gives me same error ever time</p>
  
  <pre><code>&lt;?php
  require("class.phpmailer.php");
  
  $mail = new PHPMailer();
  
  $mail-&gt;IsSMTP();                       // set mailer to use SMTP
  $mail-&gt;Host = "localhost";            // specify main and backup server
  $mail-&gt;SMTPAuth = true;               // turn on SMTP authentication
  $mail-&gt;Username = "mygmail@gmail.com";  // SMTP username
  $mail-&gt;Password = "password_is_correct"; // SMTP password
  
  $mail-&gt;From = "mygmail@gmail.com";
  $mail-&gt;FromName = "Harsh Patel";
  $mail-&gt;AddAddress("mygmail@gmail.com");          // name is optional
  
  $mail-&gt;WordWrap = 50;                         // set word wrap to 50 characters
  $mail-&gt;IsHTML(true);                            // set email format to HTML
  
  $mail-&gt;Subject = "Here is the subject";
  $mail-&gt;Body    = "This is the HTML message body &lt;b&gt;in bold!&lt;/b&gt;";
  $mail-&gt;AltBody = "This is the body in plain text for non-HTML mail clients";
  
  if(!$mail-&gt;Send())
  {
     echo "Message could not be sent. &lt;p&gt;";
     echo "Mailer Error: " . $mail-&gt;ErrorInfo;
     exit;
  }
  
  echo "Message has been sent";
  ?&gt;
  </code></pre>