laravel 5.4:预期响应代码 250,但得到代码“530”,消息为“530-5.5.1 需要身份验证。了解更多信息
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/43530976/
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 5.4 : Expected response code 250 but got code "530", with message "530-5.5.1 Authentication Required. Learn more at
提问by abdel diwat
i'm testing password reset in laravel 5.4 and i got this error :
我正在 Laravel 5.4 中测试密码重置,但出现此错误:
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/?p=WantAuthError j71sm516784wmd.12 - gsmtp
"
here is my .env
file
这是我的.env
文件
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=ssl
and my mail.php
和我的 mail.php
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.gmail.com'),
'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
'name' => env('MAIL_FROM_NAME', 'from me'),
'encryption' => env('MAIL_ENCRYPTION', 'ssl'),
'username' => env('[email protected]'),
'password' => env('mypassword'),
i Tryed to turn on "less secure apps" of my gmail account.nothing change
How do I resolve this error message?
could anyone help me please !!!
我试图打开我的 gmail 帐户的“安全性较低的应用程序”。没有任何变化
如何解决此错误消息?任何人都可以帮助我吗!!!
回答by Oleksandr
I have solved this by changing:
我已经通过更改解决了这个问题:
'username' => env('my-email'),
'password' => env('my-password'),
to
到
'username' => 'my-email',
'password' => 'my-password',
回答by AddWeb Solution Pvt Ltd
I think you can try this:
我想你可以试试这个:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=tls
Don't forget to run php artisan config:cache
after you make changes in your .env
file.
不要忘记php artisan config:cache
在对.env
文件进行更改后运行。
And you need 2-steps authentication for your Google account.
并且您需要对您的 Google 帐户进行两步验证。
Hope this work for you!
希望这对你有用!
回答by Regolith
I ran into a similar problem and what i did was
go to google settings for enabling 2 step varification from hereor follow this
我遇到了类似的问题,我所做的是
转到谷歌设置以从这里启用两步修改或按照此操作
after turning on 2 step verification App Password
link will appear right below 2 step verification. Which will take you to thislink
开启两步验证后,两步验证的App Password
正下方会出现链接。这将带你到这个链接
Then create your app password by following the process
然后按照以下过程创建您的应用密码
then copy the app password that is generated and paste it in your .env
file like follows
然后复制生成的应用密码并将其粘贴到您的.env
文件中,如下所示
MAIL_DRIVER=sendmail
[email protected]
MAIL_FROM_NAME=DomainName
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=YOUR_GMAIL_CREATED_APP_PASSWORD
MAIL_ENCRYPTION=tls
also be sure to check both smtp
and sendmail
in MAIL_DRIVER
Also run php artisan config:cache
Hope this will help
也一定要检查两者smtp
并sendmail
在MAIL_DRIVER
同时运行php artisan config:cache
希望这会有所帮助
回答by Lokesh Salvi
I also getting same issue but finally I reached by below credentials
MAIL_DRIVER=sendmail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=your-email
MAIL_PASSWORD=your-password
MAIL_ENCRYPTION=tls
Also enable **Allow less secure apps** in your gmail account follow link: https://myaccount.google.com/u/3/security
Thanks
回答by m.y.m
After enabling logging to the mail from the less secured devices, make sure that .env
file contains the following configurations:
启用从安全性较低的设备登录邮件后,请确保该.env
文件包含以下配置:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD="your_passwrod_here"
MAIL_ENCRYPTION=tls
Make sure that your password is rounded by the double quotes "" . And make sure that your mail.php file contains configurations like the following:
确保您的密码由双引号 "" 四舍五入。并确保您的 mail.php 文件包含如下配置:
'from' => [
'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
'name' => env('MAIL_FROM_NAME', 'your_email'),
],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
and don't forget to close the server and run "php artisan config:clear" to clear the configuration cache.
并且不要忘记关闭服务器并运行“php artisan config:clear”来清除配置缓存。
回答by Atmaram Nagare
Also please change code like this in mail.php
:
也请更改这样的代码mail.php
:
'username' => env('MAIL_USERNAME', 'my-email'),
'password' => env('MAIL_PASSWORD', 'my-password'),
回答by NoBugs
When you edit your .env file with the MAIL_ attributes... don't forget to scroll down and delete the default MAIL_ values included by default, or default will clobber your entered values because they are later in the file!
当您使用 MAIL_ 属性编辑 .env 文件时...不要忘记向下滚动并删除默认包含的默认 MAIL_ 值,否则默认值会破坏您输入的值,因为它们位于文件的后面!