doudi5291 2017-08-05 16:54
浏览 166

Laravel:无法使用2个可能的身份验证器在SMTP服务器上使用用户名进行身份验证

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.

This code working fine on local server. But when i tried to in godaddy server i saw the following Error :

 (1/1) Swift_TransportException Failed to authenticate on SMTP server
 with username "xxxx@gmail.com" using 2 possible authenticators in AuthHandler.php (line 181)

.env (mail part)

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=xxxx@gmail.com
MAIL_PASSWORD=xxxxxx
MAIL_ENCRYPTION=tls

Mail.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', 'xxxx@gmail.com'),
    '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?

  • 写回答

1条回答 默认 最新

  • doudengjin8251 2017-08-06 00:33
    关注

    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

    评论

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置