在 Laravel 中配置电子邮件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/52985313/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 18:08:13  来源:igfitidea点击:

Configuring Emails in Laravel

phplaravelswiftmailerlaravel-mail

提问by Nitish Kumar

I am trying to setup emails in my Laravel aplication, I have my env file something like this:

我正在尝试在我的 Laravel 应用程序中设置电子邮件,我的 env 文件是这样的:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=xxx
MAIL_ENCRYPTION=tls

I tried according to the answer given in this question Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted

我根据这个问题中给出的答案尝试了预期响应代码 250 但得到代码“535”,消息“535-5.7.8 用户名和密码不被接受

I followed the steps, enabled 2 step verification, then created app password and configured my .envfile

我按照步骤,启用了两步验证,然后创建了应用程序密码并配置了我的.env文件

Finally I did php artisan config:cache

最后我做到了 php artisan config:cache

Failed to authenticate on SMTP server with username "[email protected]" using 3 possible authenticators. Authenticator LOGIN returned Swift_TransportException: Expected response code 235 but got code "534", with message "534-5.7.14

无法使用 3 个可能的身份验证器在用户名为“[email protected]”的 SMTP 服务器上进行身份验证。身份验证器登录返回 Swift_TransportException:预期响应代码 235,但收到代码“534”,消息为“534-5.7.14”

Please help me out with this. Thanks.

这个你能帮我吗。谢谢。

回答by Ravikant gagan

Need to create new less securegmail account for configuration Email. your email should not use in more than 3 projects.

需要创建新的less securegmail 帐户进行配置Email。你的电子邮件应该not use in more than 3 projects

回答by Paul Mead

I had the same problem. It was the Captcha link that fixed the issue, even though I don't use it. It seems there is an additional step to allow new devices to open the gmail account.

我有同样的问题。验证码链接解决了这个问题,即使我不使用它。似乎还有一个额外的步骤来允许新设备打开 gmail 帐户。

https://support.google.com/mail/answer/7126229?visit_id=636865986363810933-1186759849&rd=1#cantsignin

https://support.google.com/mail/answer/7126229?visit_id=636865986363810933-1186759849&rd=1#cantsignin

I had already set up this below beforehand

我事先已经在下面设置了这个

Allow less secure apps: If you don't use 2-Step Verification, you might need to allow less secure apps to access your account.

允许安全性较低的应用:如果您不使用两步验证,则可能需要允许安全性较低的应用访问您的帐户。