Laravel-无法使用用户名在SMTP服务器上进行身份验证

时间:2020-02-27 17:17:11

标签: laravel

使用Laravel-5.8发送通知,出现此错误:

Failed to authenticate on SMTP server with username "noblemfd@gmail.com" using 3 possible authenticators. Authenticator LOGIN returned Expected response code 23 ▶
535 5.7.8  https://support.google.com/mail/?p=BadCredentials n13sm8684140wmd.21 - gsmtp
". Authenticator PLAIN returned Expected response code 235 but got code "535", with message "535-5.7.8 
Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials n13sm8684140wmd.21 - gsmtp
". Authenticator XOAUTH2 returned Expected response code 250 but got code "535", with message "535-5.7.8 
Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials n13sm8684140wmd.21 - gsmtp

它曾经工作过,但突然开始行为不当

这是我的.env

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=noblemfd@gmail.com
MAIL_PASSWORD=****
MAIL_ENCRYPTION=ssl

我该怎么办?

谢谢

1 个答案:

答案 0 :(得分:1)

我今天也遇到同样的问题。几个月来,SMTP一直运行良好,今天突然间我也收到了同样的错误。

对于我只需解决的问题,请在Google Account -> Security -> App passwords中重新生成密码。

这不是我第一次发生这种情况。也许这是Google的某种保护措施...但是我在任何地方都没有发现任何证据。无论如何,这很烦人。

我想知道如何捕获这种错误,以便我们能够按时进行干预。