title: SMTP -> ERROR: Failed to connect to server: Connection timed out (110) The following From address failed: xxxxx@gmail.com ERROR
body: <p>In contact form it's working fine in localhost. While hosted it's not working. Showing the error</p>
  
  <pre><code>**"SMTP -&gt; ERROR: Failed to connect to server: Connection timed out (110) The following From address failed: xxxxx@gmail.com ERROR"** 
  </code></pre>
  
  <p>I attached my contact_submit.php code form</p>
  
  <pre><code>    include_once('class.phpmailer.php');    
  
     $mail-&gt;IsSMTP(); // 
      $mail-&gt;Host       = "smtp.gmail.com"; 
      $mail-&gt;SMTPDebug  = 1;                    
      $mail-&gt;SMTPAuth   = true;                 
      $mail-&gt;Host       = "smtp.gmail.com"; 
      $mail-&gt;Port       = 587;                    
      $mail-&gt;Username   = "xxxx@gmail.com"; 
      $mail-&gt;Password   = "xxxx@123";        
      $mail-&gt;SMTPSecure = "tls";
      $mail-&gt;SetFrom($email, $name);
  
      $mail-&gt;AddReplyTo($email,$name);
  
      $mail-&gt;Subject    = "Contact - xxx";
  
      $mail-&gt;AltBody    = "To view the message, please use an HTML compatible email viewer!"; 
  
      $mail-&gt;MsgHTML($body);
      $mail-&gt;AddAddress("xxx@gmail.com","xxx");
  
  
      if(!$mail-&gt;Send()) 
      {
          echo $mail;
        echo "Mailer Error: " . $mail-&gt;ErrorInfo;
      } 
      else
          {
        echo '&lt;META HTTP-EQUIV="Refresh" Content="0; URL=contact.php?id='.$id.'&amp;send=success"&gt;';
        exit; 
      }
  </code></pre>
  
  <p>I'm using phpmailer 5.2.1.</p>
  
  <p>I contacted the hosting side, but i'm not getting actual response.</p>