PHPMailer Gmail服务器错误 [英] PHPMailer Gmail Server Error

查看:88
本文介绍了PHPMailer Gmail服务器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用PHPMailer时遇到了一些麻烦.有人可以帮忙吗?请不要告诉我我的用户名和密码可能是错误的.我仔细检查了一下,他们是正确的.

I'm having a little trouble with PHPMailer. Can someone help? Please don't tell me my username and password might be wrong. I triple-checked and they are correct.

我认为可能是问题所在的代码行是:

The lines of code that I think could be the issue are:

$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的功能.我不确定.

It could also be GMail's authentication is beyond the capabilities of PHPMailer. I'm not sure.

推荐答案

我遇到了这么多次. Gmail很挑剔.您需要做一些事情才能完成这项工作.

I ran into this SO many times. Gmail is finicky. You need to do some things on your end to make this work.

按照此处的说明进行操作: https://support.google.com/mail /answer/14257?rd = 1

Follow the instructions here: https://support.google.com/mail/answer/14257?rd=1

您还需要登录到Gmail帐户并转到此处: https://account.google.com/b/0/DisplayUnlockCaptcha

You'll also need to be logged into your gmail account and go here: https://accounts.google.com/b/0/DisplayUnlockCaptcha

在您帐户的安全设置下,您还必须允许安全性较差的应用程序登录到您的gmail帐户.

You'll also have to allow less secure apps to sign into your gmail account, under security settings on your account you'll have to push that button to allow.

祝你好运!进行了调整并仔细检查了三遍之后,您便可以正常使用所有密码,并且密码正确无误,您可能需要稍等片刻.真烦人!但是一旦运行,您就可以依靠它.

Good luck! After you make the adjustments and double triple check you have everything in order and your password is correct, you may have to wait a second. It's really annoying! But once it's working you can rely on it.

这篇关于PHPMailer Gmail服务器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆