I´m trying to test my emails on localhost, and I´m getting this error:
SMTP Error: Could not authenticate.
Somebody there know how to send emails on localhost? Can see if I´m doing something wrong? Because I guess everything is correct and I´m not understanding what is happening to have this error.
I did this configuration in php.ini ony my xampp folder:
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:
sendmail_from = myemail@hotmail.com
Im using php mailer class to send the email:
<?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->IsSMTP();
$mail->SMTPAuth = true;
$mail->IsHTML(true);
$mail->Host = MAILHOST;
$mail->Port = MAILPORT;
$mail->Username = MAILUSER;
$mail->Password = MAILPASS;
$mail->From = utf8_decode($sender);
$mail->FromName = utf8_decode($senderName);
if($reply != NULL){
$mail->AddReplyTo(utf8_decode($reply),utf8_decode($replyNome));
}
$mail->Subject = utf8_decode($assunto);
$mail->Body = utf8_decode($mensagem);
$mail->AddAddress(utf8_decode($destination),utf8_decode($destinationName));
if($mail->Send()){
return true;
}else{
return false;
}
}
?>