title: PHPMailer can't connect to Gmail
body: <p>So I've been scouring the web on this issue, and almost every example was condemned as a firewall or server related problem.  From what I can tell, my server is connecting just fine to gmail, but PHPMailer still fails to connect.  Here is my PHP:</p>
  
  <pre><code>require_once($_SERVER['DOCUMENT_ROOT']."/phpmailer/class.phpmailer.php");        
  $host = "smtp.gmail.com";
  $port = "587";
  $checkconn = fsockopen($host, $port, $errno, $errstr, 5);
  if(!$checkconn){
      echo "($errno) $errstr";
  } else {
      echo 'Connected through fsocketopen.&lt;br /&gt;';
  }
  
  $mail = new PHPMailer();
  
  $mail-&gt;IsSMTP();
  $mail-&gt;Host = "smtp.gmail.com";
  $mail-&gt;SMTPAuth = true;
  $mail-&gt;SMTPSecure = "ssl";
  $mail-&gt;Username = "myemail@gmail.com";
  $mail-&gt;Password = "********";
  $mail-&gt;Port = "587"; 
  </code></pre>
  
  <p>The credentials are not shown, but are 100% correct.  Here are the results:</p>
  
  <blockquote>
    <p>Connected through fsocketopen.<br />Mailer Error: SMTP Connect()
    failed.</p>
  </blockquote>
  
  <p>As you can see, the server is allowing a connection to gmail through fsocketopen, but PHPMailer will not connect.  I've even accessed my server through SSH, and received the following response:</p>
  
  <blockquote>
    <p>-bash-4.1$ telnet smtp.gmail.com 587
        Trying 2607:f8b0:400d:c02::6d...
        Connected to smtp.gmail.com.
        Escape character is '^]'.
        220 mx.google.com ESMTP g1sm52568728qec.9 - gsmtp</p>
  </blockquote>
  
  <p>So two tests verify connection between my server and Gmail is available.  So now I'm left to assume that there is a problem with my PHPMailer.  I've scanned through the class.phpmailer.php file, but I just don't know enough about it to see where there would be a problem.  Any help is appreciated!</p>