title: Failed to connect to server: Connection timed out (110)SMTP Connect() failed. Message was not sent.Mailer error: SMTP Connect() failed
body: <p>This is my code and still it is not sending the mail. What could be the problem?</p>
  
  <pre><code>require 'class.phpmailer.php';// path to the PHPMailer class
  require 'class.smtp.php';
  
              $mail = new PHPMailer();  
  
              $mail-&gt;IsSMTP();  // telling the class to use SMTP
              $mail-&gt;Mailer = "smtp";
              $mail-&gt;Host="smtp.gmail.com";
              $mail-&gt;SMTPSecure='tls';
              $mail-&gt;Port =465;             
              $mail-&gt;SMTPAuth = true; // turn on SMTP authentication
              $mail-&gt;Username = "mymailgmail.com"; // SMTP username
              $mail-&gt;Password = "mypassword"; // SMTP password 
              $mail-&gt;SMTPDebug = 1;
  
              $mail-&gt;AddAddress("mymail@gmail.com","Title");
              $mail-&gt;SetFrom($visitor_email, $name);
              $mail-&gt;AddReplyTo($visitor_email,$name);
  
              $mail-&gt;Subject  = "Message from  Contact form";
              $mail-&gt;Body     = $user_message;
              $mail-&gt;WordWrap = 50;  
  
              if(!$mail-&gt;Send()) {
              echo 'Message was not sent.';
              echo 'Mailer error: ' . $mail-&gt;ErrorInfo;
              } else {
              echo 'Message has been sent.';
              }
  </code></pre>
  
  <p>//      header('Location: thank-you.html');
      }</p>