我在一個簡單的腳本使用的PHPMailer對於發送EMAIL的通過Gmail和我得到「未知錯誤」(至少對我來說!):「SMTP錯誤:無法驗證」在PHPMailer的
SMTP Error: Could not authenticate. Error: SMTP Error: Could not authenticate.
SMTP server error: 5.7.1 Username and Password not accepted. Learn more at 535 5.7.1 http://mail.google.com/support/bin/answer.py?answer=14257 p38sm2467302ybk.16
我讀過關於配置OpenSSL SSL/TLS連接,我做到了。 Apache和PHP已正確配置(使用OpenSSL擴展運行在PHP中,mod_ssl運行在Apache 2.2.16中)。
這是PHP腳本:
<?php
require_once ("PHPMailer\class.phpmailer.php");
$Correo = new PHPMailer();
$Correo->IsSMTP();
$Correo->SMTPAuth = true;
$Correo->SMTPSecure = "tls";
$Correo->Host = "smtp.gmail.com";
$Correo->Port = 587;
$Correo->UserName = "[email protected]";
$Correo->Password = "gmailpassword";
$Correo->SetFrom('[email protected]','De Yo');
$Correo->FromName = "From";
$Correo->AddAddress("[email protected]");
$Correo->Subject = "Prueba con PHPMailer";
$Correo->Body = "<H3>Bienvenido! Esto Funciona!</H3>";
$Correo->IsHTML (true);
if (!$Correo->Send())
{
echo "Error: $Correo->ErrorInfo";
}
else
{
echo "Message Sent!";
}
?>
用戶名和密碼都OK,我試圖在Thunderbird中,沒有任何問題。 我也使用SSL身份驗證和端口465,得到相同的錯誤。
這很奇怪,因爲錯誤很明顯地指向了用戶名/密碼錯誤而不是協議問題。您的密碼中不會有特殊字符可能會錯誤地傳送? – 2010-10-16 17:18:43