PHPMailer не может аутентифицироваться - PullRequest
0 голосов
/ 15 февраля 2012

Я получил эту ошибку, используя PHPMailer:

SMTP Error: Could not authenticate. Mailer Error: SMTP Error: Could not authenticate.

и вот код:

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->IsSMTP(); // telling the class to use SMTP
$mail->SMTPDebug = true;
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "TLS"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 587; // set the SMTP port for the GMAIL server
$mail->Username = "user"; // GMAIL username
$mail->Password = "pass"; // GMAIL password
$mail->SetFrom('e.salamati.taba@gmail.com', 'no-reply gmail.com');
$mail->Subject = $mail_arr['subject'];
$mail->MsgHTML($body);
echo "-----------------------";
$address = $reciever;
$mail->AddAddress($address, "e.salamati.taba@gmail.com");

if(! $mail->Send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
} else {
    echo "Message sent!";
}

}

Я также вижу это , но все равно есть ошибка. Есть ли какая-либо конфигурация xampp или что-то, что вызывает проблему?Заранее спасибо ...

...