title: phpmailer not working with gmail
body: <p>i ve been trying to test sending emails from php using the phpmailer class. my config is this:</p>
  
  <pre><code>require '../php/library/class.phpmailer.php';
  require '../php/library/class.smtp.php';
  
  $mail = new PHPMailer;
  
  $mail-&gt;isSMTP();
  
  $mail-&gt;SMTPDebug = 2;
  
  $mail-&gt;Debugoutput = 'html';
  
  $mail-&gt;Host = 'smtp.gmail.com';
  
  $mail-&gt;Port = 587;
  
  $mail-&gt;SMTPSecure = 'ssl';
  
  $mail-&gt;SMTPAuth = true;
  
  $mail-&gt;Username = "anactual@email.com";
  
  $mail-&gt;Password = "thepassword";
  
  $mail-&gt;setFrom('existing@gmail.com', 'Real Name');
  
  $mail-&gt;addAddress( $validEmail );
  
  $mail-&gt;Subject = 'Confirmation Code';
  
  $mail-&gt;msgHTML('Follow this link: &lt;a href="http://test.com/confirm?code=' . $newAccount-&gt;confirmationCode . '"&gt;http://test.com/confirm?code=' . $newAccount-&gt;confirmationCode . '&lt;/a&gt;');
  
  $mail-&gt;AltBody = 'This is a plain-text message body with this link: http://test.com/confirm?code=' . $newAccount-&gt;confirmationCode;
  
  if (!$mail-&gt;send()) {
      echo "Mailer Error: " . $mail-&gt;ErrorInfo;
  }
  </code></pre>
  
  <p>However, things do not seem to work, and i just copy pasted the code from the gmail example. i ve searched the world wide web for the error output:</p>
  
  <pre><code>SMTP ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: Name or service not known (0)
  SMTP connect() failed.
  Mailer Error: SMTP connect() failed.
  </code></pre>
  
  <p>but still can not find out wha't wrong. any help please?</p>
  
  <p><strong>UPDATE</strong> i have disabled the two step verification in gmail</p>