title: PHP mailer not working on cpanel
body: <p>my php mailer is working fine on localhost but when I m running same code on cpanel I m getting Error message :SMTP connect() failed</p>
  
  <pre><code>&lt;?php
  require 'PHPMailer/PHPMailerAutoload.php';
  $mail = new PHPMailer;
  $mail-&gt;isSMTP();                                     
  $mail-&gt;Host = "tls://smtp.gmail.com"; 
  $mail-&gt;SMTPAuth = true;                               
  $mail-&gt;Username = '********@gmail.com';                 
  $mail-&gt;Password = '********';                           
  
  $mail-&gt;Port = 587;                                   
  
  $mail-&gt;setFrom('sender@gmail.com', 'Mailer');
  $mail-&gt;AddAddress('receiver@gmail.com', 'Joe User');    
  $mail-&gt;addReplyTo('sender@gmail.com', 'Information');
  
  $mail-&gt;isHTML(true);                                  
  $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.';
  echo 'Mailer Error: ' . $mail-&gt;ErrorInfo;
  } else {
  echo 'Message has been sent';
  }
  ?&gt;
  </code></pre>
  
  <p>Pls help me, where I am getting wrong?</p>