且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何解决“无法与主机 smtp.gmail.com 建立连接"?

更新时间:2021-08-27 07:53:20

几天前我遇到了完全相同的问题,我到处搜索laracast ***和许多github问题,终于解决了问题.

Few days ago I've faced exactly the same problem and I've searched everywhere like laracast *** and many github issues and finally solve the problem.

你需要这样的配置,

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=youremail@gmail.com
MAIL_PASSWORD=yourpassword
MAIL_ENCRYPTION=ssl

完成此设置后,您应该确保您的 google 帐户 2 步验证 已关闭,因为这增加了额外的安全层,这就是无法建立连接的原因.

After this setup you should make sure that your google account 2 step verification is turned off because this adds an extra layer of security that's why connection can't be established.

我认为这是谷歌最近添加的新功能.我以前进行过邮件配置,但最近相同的代码不起作用.

I think this is new feature added by google recently. I've working mail configuration before but recently same code doesn't work.

您可以转到您的 google 帐户,在那里您将看到 登录和安全 选项卡.单击它,您将在此处看到 2 步验证.然后你需要关闭它.然后我认为它会起作用.

You can go to your google account where you will see Sign-in and Security tab. Click on it then you will see 2 step verfication there. Then you need to turn off that. Then I think it'll work.

这件事对我有用,我希望它也对你有用.希望你能理解.

This thing worked for me I hope it'll work for you as well. I hope you understand.