title: PHPMailer Authentication unsuccessful
body: <p>When I try to use PHPMailer on windows server 2012 at work to send report emails using SMTP I got Authentication unsuccessful error.</p>
  
  <p>I'm using server administrator account on domain.</p>
  
  <p>I'm very sure of the correction of the password.</p>
  
  <p>check the code below:</p>
  
  <pre><code>require '../PHPMailerAutoload.php';
  
  $mail = new PHPMailer;
  $mail-&gt;isSMTP();
  $mail-&gt;SMTPDebug = 2;
  $mail-&gt;Debugoutput = 'html';
  $mail-&gt;Host = 'mail.example.com';
  $mail-&gt;Port = 25;
  $mail-&gt;SMTPSecure = 'tls';
  $mail-&gt;SMTPAuth = true;
  $mail-&gt;Username = "username@example.com";
  $mail-&gt;Password = "yourpassword";
  $mail-&gt;setFrom('from@example.com', 'First Last');
  $mail-&gt;addAddress('whoto@example.com', 'John Doe');
  $mail-&gt;Subject = 'PHPMailer SMTP options test';
  $mail-&gt;msgHTML($html_message);
  </code></pre>
  
  <p>I got the below response:</p>
  
  <pre><code>SERVER -&gt; CLIENT: 220 exchangeserverhost.com Microsoft ESMTP MAIL Service ready at Tue, 3 Nov 2015 22:19:26 +0300
  CLIENT -&gt; SERVER: EHLO exchangeserverhost.com
  SERVER -&gt; CLIENT: 250-exchangeserverhost.com Hello 
  CLIENT -&gt; SERVER: STARTTLS
  SERVER -&gt; CLIENT: 220 2.0.0 SMTP server ready
  CLIENT -&gt; SERVER: EHLO exchangeserverhost.com
  SERVER -&gt; CLIENT: 250-exchangeserverhost.com Hello 
  CLIENT -&gt; SERVER: AUTH LOGIN
  SERVER -&gt; CLIENT: 334 
  CLIENT -&gt; SERVER: 
  SERVER -&gt; CLIENT: 334 
  CLIENT -&gt; SERVER: ==
  SERVER -&gt; CLIENT: 535 5.7.3 Authentication unsuccessful
  SMTP ERROR: Password command failed: 535 5.7.3 Authentication unsuccessful
  SMTP Error: Could not authenticate.
  CLIENT -&gt; SERVER: QUIT
  SERVER -&gt; CLIENT: 221 2.0.0 Service closing transmission channel
  SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
  Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
  </code></pre>