Laravel:无法使用 2 个可能的身份验证器使用用户名在 SMTP 服务器上进行身份验证
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45524346/
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
Laravel :Failed to authenticate on SMTP server with username using 2 possible authenticators
提问by User57
I've configured to gmail SMTP server to send email. Account less secure app turned ON, also Recapture enabled. Here is the mail.php configuration.
我已经配置到 gmail SMTP 服务器来发送电子邮件。帐户安全性较低的应用程序已打开,还启用了重新捕获。这是mail.php 配置。
This code working fine on local server. But when i tried to in godaddy server i saw the following Error :
此代码在本地服务器上运行良好。但是当我尝试在 Godaddy 服务器中时,我看到以下错误:
(1/1) Swift_TransportException Failed to authenticate on SMTP server
with username "[email protected]" using 2 possible authenticators in AuthHandler.php (line 181)
.env (mail part)
.env(邮件部分)
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=xxxxxx
MAIL_ENCRYPTION=tls
Mail.php
邮件.php
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.gmail.com'),
'port' => env('MAIL_PORT', 587),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
'name' => env('MAIL_FROM_NAME', 'xxxx'),
],
'encryption' => env('MAIL_ENCRYPTION', 'TLS'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
What should I do now?
我现在该怎么办?
回答by F?rid Babayev
This is an old thread, but my resolution was a bit different for the same error. Turns out my Swift configuration is fine. The IP from my server was blocked by Google as suspicious. I was able to clear it by visiting this link, then executing my mailer code from the server. http://www.google.com/accounts/DisplayUnlockCaptcha
这是一个旧线程,但对于相同的错误,我的解决方案略有不同。结果证明我的 Swift 配置很好。来自我服务器的 IP 被谷歌以可疑方式阻止。我可以通过访问此链接清除它,然后从服务器执行我的邮件程序代码。 http://www.google.com/accounts/DisplayUnlockCaptcha