title: PHPMail GMAIL - No route to host (65) SMTP connect() failed.
body: <p>I'm having an error when trying to send emails using PHPMailer through gmail server. I cannot say what is the problem I triple checked the code google it without finding why is this happening. Yesterday was working perfectly today I wake up try it again and sends this error.</p>
  
  <p>The error is the following:</p>
  
  <p>SMTP ERROR: Failed to connect to server: No route to host (65) SMTP connect() failed. </p>
  
  <p>The code is this:</p>
  
  <pre><code>    $user = $_SESSION['user'];
  $query = "SELECT email FROM rnmembers WHERE user='$user'";
  $result  = queryMysql($query);
  $user_email_array = mysql_fetch_row($result);
  $user_email = $user_email_array[0];
  
  require_once('PHPMailer/PHPMailerAutoload.php');
  
  $mail             = new PHPMailer();
  
  $body             = file_get_contents('content.html');
  $body             = eregi_replace("[\]",'',$body);
  
  $mail-&gt;IsSMTP(); // telling the class to use SMTP
  $mail-&gt;Host       = "ssl://smtp.googlemail.com";        // SMTP server
  $mail-&gt;SMTPDebug  = 1;                                  // enables SMTP debug information (for testing)
  // 1 = errors and messages
  // 2 = messages only
  $mail-&gt;SMTPAuth   = true;                               // enable SMTP authentication
  $mail-&gt;Host       = "ssl://smtp.googlemail.com";        // sets the SMTP server
  $mail-&gt;Port       = 465;                                // set the SMTP port for the GMAIL server
  $mail-&gt;Username   = "email@gmail.com";    // SMTP account username
  $mail-&gt;Password   = "password";                      // SMTP account password
  
  $mail-&gt;SetFrom('oscar.panczenko.web@gmail.com', 'Virtual Tutors');
  //$mail-&gt;AddReplyTo("email@gmail.com","Web Master");
  $mail-&gt;Subject    = "Your training appointment - Virtual Tutor.";
  $mail-&gt;AltBody    = "To view the message, please use an HTML compatible email viewer!";
  $mail-&gt;MsgHTML($body);
  $address = $user_email;
  $mail-&gt;AddAddress($address, $user);
  //$mail-&gt;AddAttachment("images/phpmailer.gif");      // attachment
  //$mail-&gt;AddAttachment("images/phpmailer_mini.gif"); // attachment
  
  if(!$mail-&gt;Send())
  {
      echo "&lt;br/ &gt;&lt;br /&gt;Mailer Error: " . $mail-&gt;ErrorInfo;
      echo "&lt;br /&gt;";
  }
  else
  {
      echo "&lt;br /&gt;&lt;br /&gt;Message sent!&lt;br /&gt;";
  }
  </code></pre>
  
  <p>Any hints?</p>
  
  <p>Kind regards.</p>
  
  <p>Oscar.</p>