我在使用PHPMailer时遇到了一些问题,有人可以帮忙吗?请不要告诉我我的用户名和密码可能是错误的。我已经三次检查过了,它们是正确的。
我认为可能有问题的代码行是:
$mail->Host = 'smtp.gmail.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = '*********@gmail.com';
$mail->Password = '*********';
$mail->setFrom('*********@gmail.com','Name');
错误日志输出如下:
2015-12-31 16:46:17 CLIENT -> SERVER: EHLO nfective.com
2015-12-31 16:46:17 CLIENT -> SERVER: STARTTLS
2015-12-31 16:46:17 CLIENT -> SERVER: EHLO nfective.com
2015-12-31 16:46:17 CLIENT -> SERVER: AUTH LOGIN
2015-12-31 16:46:17 CLIENT -> SERVER: bmZlY3RpdmVAZ21haWwuY29t
2015-12-31 16:46:17 CLIENT -> SERVER: JCNAZDB3MTM=
2015-12-31 16:46:17 SMTP ERROR: Password command failed: 534-5.7.14
Please log in via your web browser and 534-5.7.14 then try again. 534-5.7.14 Learn more at 534 5.7.14 https://support.google.com/mail/answer/78754 w32sm33173561qgw.6 - gsmtp 2015-12-31 16:46:17 SMTP Error: Could not authenticate. 2015-12-31 16:46:17 CLIENT -> SERVER: QUIT 2015-12-31 16:46:17 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting bool(false)
可能是Gmail的身份验证超出了PHPMailer的能力范围,我不确定。