laravel 密码重置邮件收到 530 5.7.1 需要身份验证

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40942881/
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 14:51:43  来源:igfitidea点击:

Password reset email getting 530 5.7.1 Authentication required

laravellaravel-5.3

提问by jerauf

When I try to send a password reset email, I get the following error:

当我尝试发送密码重置电子邮件时,出现以下错误:

Swift_TransportException in AbstractSmtpTransport.php line 383:
Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required"

I'm not sure what's wrong here. I've looked at Stack Overflow and Laracasts and found similar problems. I've tried two different email addresses and servers. But I'm getting the same error.

我不确定这里出了什么问题。我查看了 Stack Overflow 和 Laracasts 并发现了类似的问题。我尝试了两种不同的电子邮件地址和服务器。但我遇到了同样的错误。

Here's my .env file:

这是我的 .env 文件:

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

Here is my mail.php file:

这是我的 mail.php 文件:

'driver' => env('MAIL_DRIVER'),
'host' => env('MAIL_HOST'),
'port' => env('MAIL_PORT'),
'from' => [
   'address' => '[email protected]',
   'name' => 'XX',
],
'encryption' => env('MAIL_ENCRYPTION'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',

Any ideas what I've got wrong here?

知道我在这里有什么问题吗?

回答by jerauf

I found that changing the .env file requires you to clear you config cache:

我发现更改 .env 文件需要您清除配置缓存:

php artisan config:cache

This worked and now email is sending.

这有效,现在电子邮件正在发送。