问题描述
我将在接下来的 8 小时内部署一个网站,而 Gmail 只是停止接受 PHPmailer 登录我的帐户.起初它在测试时工作了几个小时.然后,它就停止了工作.我已经允许所有允许不太安全的应用程序从 gmail 登录,但它仍然不允许 phpmailer 登录.我想跳下悬崖!
I'm about to deploy a website in the next 8h and Gmail just stop accepting PHPmailer sign in to my account. At first it worked, for a bunch of hours while testing. Then, it just stopped working.. I already allowed all the allow less secure apps to sign in from gmail but it just still don't allow phpmailer to sign in. I want to jump off a cliff!
这是几个小时前运行良好的相同代码:
Here is the same code that worked brilliant a few hours ago:
$mail->SMTPDebug = 0;
$mail->isSMTP();
$mail->Host = "smtp.gmail.com";
$mail->SMTPAuth = true;
$mail->Username = 'myemail@gmail.com';
$mail->Password = 'password';
$mail->SMTPSecure = 'ssl';
$mail->Port = 587;
然后由于某种原因,gmail 刚刚开始阻止登录尝试.我希望我能在这里得到一些帮助,我已经找了一个多小时了,仍然没有任何结果.
Then for some reason gmail just started blocking the sign in attemps. I hope I could get some help here, I already looked for over an hour and still got nothing.
谢谢!
推荐答案
已解决!我希望这对将来的其他人有所帮助..即使我启用了 gmail访问不太安全的应用程序",它仍然拒绝 PHPmailer 登录..似乎由于某种原因 gmail 不接受端口 587,至少对我来说,所以我把它切换到 465 并且一切都开始正常工作了.
Resolved! I hope this helps others in the future.. Even though I enabled gmail "access to less secure apps" it kept rejecting the PHPmailer sign in.. Seems that for some reason gmail wasn't accepting port 587, at least for me, so I switched it to 465 and everything started working right a way.
作为这个答案的一个优点,至于@Amit Merchant 在评论部分提出的建议,我不知道 stackoverflow.com/a/33667250/1485183 中的最后一条评论说什么,它基本上显示了一个 gmail 功能在为我的问题寻找解决方案时,我从未发现或听说过:accounts.google.com/DisplayUnlockCaptcha
As a plus for this answer, as for what @Amit Merchant suggested in the comment section, I wasn't aware of what the last comment in stackoverflow.com/a/33667250/1485183 says, it basically shows a gmail feature I never found or heard when looking for a solution for my problem, that this: accounts.google.com/DisplayUnlockCaptcha
我敢肯定,无论是用于 phpmailer 还是任何其他库,这都会在某一天帮助到某人.
I'm sure this will help someone some day whether if it's for phpmailer or any other library.
这篇关于gmail一直阻止PHPmailer登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!