本文介绍了Laravel SwiftMailer:预期的响应代码为250,但得到的代码为"530",消息为"530-5.5.1"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用laravel 5.2,并且正在使用Swift Mailer进行密码重置.我的gmail上有两步验证..

I am using laravel 5.2, And the using Swift Mailer for password resetting.I have 2-step verification on my gmail..

正如Google帮助所说:

As the google help says :

如果您为帐户启用了两步验证,则可能需要输入应用密码而不是常规密码.

If you've turned on 2-Step Verification for your account, you might need to enter an App password instead of your regular password.

我在mail.php上具有以下设置:

return [
    'driver' => env('MAIL_DRIVER', 'smtp'),
    'host' => env('MAIL_HOST', 'smtp.gmail.com'),
    'port' => env('MAIL_PORT', 465),
    'from' => ['address' => '[email protected]', 'name' => 'Shafee'],
    'encryption' => env('MAIL_ENCRYPTION', 'ssl'),
    'username' => env('[email protected]'),
    'password' => env('MY_Gmail_API_KEY'),
    'sendmail' => '/usr/sbin/sendmail -bs',
    'pretend' => env('MAIL_PRETEND', false),

];

.env上,我有:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=MY_Gmail_API_KEY
MAIL_ENCRYPTION=ssl

出现以下错误:

Swift_TransportException in AbstractSmtpTransport.php line 383:

Expected response code 250 but got code "530", with message "530-5.5.1 Authentication Required. 

Learn more at
530 5.5.1 https://support.google.com/mail/answer/14257 w10sm15831823wjk.18 - gsmtp
"

推荐答案

尝试打开此页面.阅读此google答案.

这篇关于Laravel SwiftMailer:预期的响应代码为250,但得到的代码为"530",消息为"530-5.5.1"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 18:13