Laravel 5.5预期响应代码为250,但代码为"530". [英] Laravel 5.5 Expected response code 250 but got code "530"

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

问题描述

我知道这是StackOverFlow中的重复问题(),但是,我已经完成了此处讨论的所有解决方法运气.我正在使用我的GMail帐户使用mailtrap.io.这是.env文件和mail.php(在配置下):

I know it is a duplicate issue in StackOverFlow (Laravel SwiftMailer : Expected response code 250 but got code "530", with message "530-5.5.1 Authentication Required) however, I'm done all the remedies discussed there but still no luck. I'm using mailtrap.io using my GMail account. Here is the .env file and mail.php (under config):

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=XXXX
MAIL_PASSWORD=XXXX
MAIL_ENCRYPTION=tls

mail.php

'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.mailtrap.io'),
'port' => env('MAIL_PORT', 2525),
'from' => [
        'address' => env('MAIL_FROM_ADDRESS', 'niladriXXX@XXX.com'),
        'name' => env('MAIL_FROM_NAME', 'Niladri Banerjee'),
    ],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'sendmail' => '/usr/sbin/sendmail -t -i',
'markdown' => [
        'theme' => 'default',

        'paths' => [
            resource_path('views/vendor/mail'),
        ],
    ],

从忘记密码"屏幕提交有效的电子邮件后,它将引发以下错误:

After submitting the valid email from forgot password screen, it throws the following error:

期望的响应代码为250,但得到的代码为"530",并显示消息"530 5.7.1需要验证"

Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required "

请注意:我已经从GMail的登录和安全"中启用了允许安全程度较低的应用程序".

Please note: I have already ON 'Allow less secure apps' from "Sign-in & security" from my GMail.

寻求帮助.

PS:我正在本地主机上运行项目.

PS: I'm running the project in localhost.

推荐答案

我可能建议您也使用它,它对我很有用,

I' may suggest you use this as well, it worked for me,

请注意,如果您使用的是Gmail:创建一个gmail应用程序密码,但请确保已设置两步验证",从登录和安全起,使用以下链接:

Please Note if you're using Gmail: create a gmail app password, but be sure to your 2 Step verification set up, from sign in and securiity, the following link: https://myaccount.google.com/apppasswords to setup app password, use that and follow procedure 2 after this return to set up gmail with smtp.

请注意:下面的代码是针对mail.php文件的

please note: code down below are for mail.php file

(不要忘记使用:php artisan config:cache)还要更改.env文件之后

(do not forget to use: php artisan config:cache) after changes to .env file as well

return [

'driver' => env('MAIL_DRIVER', 'smtp'),

'host' => env('MAIL_HOST', 'smtp.mailtrap.io'),

'port' => env('MAIL_PORT', 2525),

'from' => [
        'address' => env('MAIL_FROM_ADDRESS', 'lxxxx@xxxx.com'),
        'name' => env('MAIL_FROM_NAME', 'myMail'),
    ],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),

'username' => env('MAIL_USERNAME'),//this setting in .env only leave as is here

'password' => env('MAIL_PASSWORD'),//this setting in .env only leave as is here

'sendmail' => '/usr/sbin/sendmail -bs',

'stream' => [
    'ssl' => [
        'allow_self_signed' => true,
        'verify_peer' => false,
        'verify_peer_name' => false,
    ],
    ],

    'markdown' => [
        'theme' => 'default',

        'paths' => [
            resource_path('views/vendor/mail'),
        ],
    ],
];

//gmail的步骤2返回[

//procedure 2 for gmail return [

'driver' => env('MAIL_DRIVER', 'smtp'),

'host' => env('MAIL_HOST', 'smtp.gmail.com'),

'port' => env('MAIL_PORT', 587),

'from' => [
        'address' => env('MAIL_FROM_ADDRESS', 'lxxxx@gmail.com'),
        'name' => env('MAIL_FROM_NAME', 'myMail'),
    ],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),

'username' => env('MAIL_USERNAME'),//this setting in .env only leave as is here

'password' => env('MAIL_PASSWORD'),//this setting in .env only (use app password you created for gmail and PLEASE leave as is here

'sendmail' => '/usr/sbin/sendmail -bs',

'stream' => [
    'ssl' => [
        'allow_self_signed' => true,
        'verify_peer' => false,
        'verify_peer_name' => false,
    ],
    ],

    'markdown' => [
        'theme' => 'default',

        'paths' => [
            resource_path('views/vendor/mail'),
        ],
    ],
];

希望它会有所帮助.亲切的问候

Hope it helps. Kind regards

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

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆