title: sending phpmailer smtp email with gmail takes long time (1.5 seconds)
body: <p>The following script takes about 1.5 seconds to send an email as measured by the timers across the <code>$mail-&gt;send()</code> line.  If I don't use smtp, it goes MUCH faster, however, some mail servers will block the incoming email.</p>
  
  <p>What is causing the delay?  If there is nothing that could be done about it, what would be a good solution to prevent the user from having to wait for it?</p>
  
  <pre><code>&lt;?php
  require_once ('../../application/classes_3rd/PHPMailer/PHPMailerAutoload.php');
  class myPHPMailer extends PHPMailer
  {
      public function __construct()
      {
          $this-&gt;isSMTP();
          $this-&gt;SMTPDebug = 0;
          $this-&gt;Host = 587;
          $this-&gt;Port = "smtp.gmail.com";
          $this-&gt;SMTPSecure="tls";
          $this-&gt;SMTPAuth = true;
          $this-&gt;Username = "example@gmail.com";
          $this-&gt;Password = "my_password";
      }
  }
  
  try {
      $mail = new myPHPMailer(true);
      $mail-&gt;AddReplyTo('me@example.com');
      $mail-&gt;SetFrom('me@example.com');
      $mail-&gt;AddAddress('me@example.com', 'John Doe');
      $mail-&gt;Subject = "My subject";
      $mail-&gt;MsgHTML("Hello!  Click this link https://www.google.com/");
      $time=microtime(1);
      $mail-&gt;Send();
      echo(microtime(1)-$time);
  } catch (phpmailerException $e) {
      trigger_error($e-&gt;errorMessage(), E_USER_ERROR);
  }
  
  ?&gt;
  </code></pre>