title: PHPMailer Could not Authenticate
body: <p>I got this error using PHPMailer:   </p>
  
  <pre><code>SMTP Error: Could not authenticate. Mailer Error: SMTP Error: Could not authenticate.
  </code></pre>
  
  <p>and Here is the code :    </p>
  
  <pre><code>function send_email($reciever = "e.salamati.taba@gmail.com", $mail_arr = '') { // This function will be upgraded later
  $mail = new PHPMailer();
  $body = $mail_arr['body'];
  //$body = eregi_replace("[\]", '', $body);
  $mail-&gt;IsSMTP(); // telling the class to use SMTP
  $mail-&gt;SMTPDebug = true;
  $mail-&gt;SMTPDebug = 2; // enables SMTP debug information (for testing)
  // 1 = errors and messages
  // 2 = messages only
  $mail-&gt;SMTPAuth = true; // enable SMTP authentication
  $mail-&gt;SMTPSecure = "TLS"; // sets the prefix to the servier
  $mail-&gt;Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
  $mail-&gt;Port = 587; // set the SMTP port for the GMAIL server
  $mail-&gt;Username = "user"; // GMAIL username
  $mail-&gt;Password = "pass"; // GMAIL password
  $mail-&gt;SetFrom('e.salamati.taba@gmail.com', 'no-reply gmail.com');
  $mail-&gt;Subject = $mail_arr['subject'];
  $mail-&gt;MsgHTML($body);
  echo "-----------------------";
  $address = $reciever;
  $mail-&gt;AddAddress($address, "e.salamati.taba@gmail.com");
  
  if(! $mail-&gt;Send()) {
      echo "Mailer Error: " . $mail-&gt;ErrorInfo;
  } else {
      echo "Message sent!";
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I have also see <a href="https://stackoverflow.com/questions/3949824/smtp-error-could-not-authenticate-in-phpmailer">this</a>, but still got the error, Is there any xampp config or something that cause the problem?
  Thanks in advance...</p>