title: Trying to test send emails on localhost -> SMTP Error: Could not authenticate
body: <p>Im trying to test my emails functions in localhost with phpmailer class.</p>
  
  <p>But I´m getting this error: <strong>SMTP Error: Could not authenticate..</strong></p>
  
  <p>And this error its because I dont have a localhost email configured. </p>
  
  <p>I already did this configuration in my Xampp php.ini to try test emails on localhost:</p>
  
  <pre><code>[mail function]
  ; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
  ; SMTP = localhost
   smtp_port = 25
  
  ; For Win32 only.
  ; http://php.net/sendmail-from
  sendmail_from = myemail@hotmail.com
  </code></pre>
  
  <p>But its not working, Somebody there knows How to do this work on windows 8 with xampp?</p>
  
  <pre><code>&lt;?php
      define('MAILUSER','myemail@hotmail.com');
      define('MAILPASS','');
      define('MAILPORT','587');
      define('MAILHOST','smtp.live.com');
      define('SITENAME', 'Site Name');    
  
          function sendMail($subject,$message,$sender,$senderName,$destination,$destinationName, $reply = NULL, $replyNome = NULL){
  
              require_once('mail/class.phpmailer.php'); 
  
              $mail = new PHPMailer(); 
              $mail-&gt;IsSMTP(); 
              $mail-&gt;SMTPAuth = true; 
              $mail-&gt;IsHTML(true);
  
              $mail-&gt;Host = MAILHOST; 
              $mail-&gt;Port = MAILPORT; 
              $mail-&gt;Username = MAILUSER; 
              $mail-&gt;Password = MAILPASS; 
  
              $mail-&gt;From = utf8_decode($sender); 
              $mail-&gt;FromName = utf8_decode($senderName); 
  
              if($reply != NULL){
                  $mail-&gt;AddReplyTo(utf8_decode($reply),utf8_decode($replyNome)); 
              }
  
              $mail-&gt;Subject = utf8_decode($assunto); 
              $mail-&gt;Body = utf8_decode($mensagem); 
              $mail-&gt;AddAddress(utf8_decode($destino),utf8_decode($destinationName)); 
  
              if($mail-&gt;Send()){
                  return true;
              }else{
                  return false;
              }
          }   
      ?&gt;
  </code></pre>
  
  <p>Here I send the email:</p>
  
  <pre><code>$msg = 'hello';
  sendMail('Sent email!',$msg,MAILUSER,SITENAME,$assoc['email'],$assoc['name']);
  </code></pre>