利用PHPMailer中Gmail发送邮件相关问题

原创
2017/08/17 16:30
阅读数 90

1、利用smtp.gmail.com邮箱服务发送邮件会产生验证失败或其它问题,报错例子:

SMTP ERROR: Password command failed: 534-5.7.14 
Please log in via your web browser and then try again.
  534 5.7.14 54 k76sm17979938yho.18 - gsmtp

问题缘由:

google账号其他地点登陆的时候会有安全验证,如果没有进行相关设置,默认是禁止在这些不安全地点登陆的,所以就导致了上面那个报错。

建议解决办法:

查看最近尝试使用该帐户并接受可疑访问:https://myaccount.google.com/device-activity?hl=en&pli=1

开启这个:https://myaccount.google.com/u/1/lesssecureapps   

允许不够安全的应用  需要开启这个选项。

然后再试一下是否发送成功。

原文:

A bit late, but perhaps someone will find it useful.

Links that fix the problem (you must be logged into google account):

https://security.google.com/settings/security/activity?hl=en&pli=1

https://www.google.com/settings/u/1/security/lesssecureapps

https://accounts.google.com/b/0/DisplayUnlockCaptcha

Some explanation of what happens:

This problem can be caused by either 'less secure' applications trying to use the email account (this is according to google help, not sure how they judge what is secure and what is not) OR if you are trying to login several time in a row OR if you change countries (for example use VPN, move code to different server or actually try to login from different part of the world).

To resolve I had to: (first time)

  • login to my account via web
  • view recent attempts to use the account and accept suspicious access: THIS LINK
  • disable the feature of blocking suspicious apps/technologies: THIS LINK

This worked the first time, but few hours later, probably because I was doing a lot of testing the problem reappeared and was not fixable using the above method. In addition I had to clear the captcha (the funny picture, which asks you to rewrite a word or a sentence when logging into any account nowadays too many times) :

  • after login to my account I went HERE
  • Clicked continue

Hope this helps.

 

 

谷歌SMTP pop 相关:https://support.google.com/mail/answer/7126229?visit_id=1-636385526785388139-492505572&hl=zh-Hans&rd=1

 

展开阅读全文
加载中

作者的其它热门文章

打赏
0
0 收藏
分享
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部