我尝试使用PHPMailer发送SMTP邮件 这是我的代码
$mail = new PHPMailer;
$mail->SMTPDebug = 3;
$mail->isSMTP();
$mail->Host = "smtp.gmail.com";
$mail->SMTPAuth = true;
$mail->Username = "xxxx@xxxx.net";
$mail->Password = "xxxxx";
$mail->Port = 587;
$mail->From = "xxxx@xxxx.net";
$mail->FromName = "XXXXXXX";
$mail->addAddress("xxxx@xxxxx.com", "XXXXXXXXX");
$mail->isHTML(true);
$mail->Subject = "Subject Text";
$mail->Body = "<i>Mail body in HTML</i>";
$mail->AltBody = "This is the plain text version of the email content";
if(!$mail->send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message has been sent successfully";
}
它给了我那个错误
邮件程序错误:SMTP连接()失败
我在https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
中看到了wiki我已经停止了我的防火墙,opensssl正在运行,我的主机,密码和用户名都是正确的。
在调试中他给了我那个
然后他给了我密码命令失败
SMTP错误:无法进行身份验证。