php Laravel 邮件到日志
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/42798745/
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 Mail to Log
提问by Vranvs
I have my Laravel Mail driver setup as to print to my log file:
我有我的 Laravel 邮件驱动程序设置为打印到我的日志文件:
'driver' => env('MAIL_DRIVER', 'log'),
When I send mail, however, I am receiving a swiftmail authentication error:
但是,当我发送邮件时,我收到了 swiftmail 身份验证错误:
Expected response code 250 but got code '530' with message '530 5.7.1 Authentication required'
vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\AbstractSmtpTransport.php
line 383\">AbstractSmtpTransport.php line 383
530 5.7.1 Authentication required
预期响应代码 250,但得到代码“530”,消息“530 5.7.1 需要身份验证”
vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\AbstractSmtpTransport.php
第 383 行\">AbstractSmtpTransport.php 第 383 行
530 5.7.1 Authentication required
Is there another setting I need to set somewhere? Why is it trying to use swiftmailer?
我需要在某处设置其他设置吗?为什么要尝试使用 swiftmailer?
回答by Serge
This is in your Mail.php config file...
这是在您的 Mail.php 配置文件中...
When using
使用时
'driver' => env('MAIL_DRIVER', 'log'),
This will get the MAIL_DRIVER environment variable set in your .env file. In this case, 'log' is used only as a default if a value is not specified in your .env file... Your .env file probably has this still set in it... set it to log...
这将在您的 .env 文件中设置 MAIL_DRIVER 环境变量。在这种情况下,如果您的 .env 文件中未指定值,则 'log' 仅用作默认值...您的 .env 文件中可能仍然设置了该值...将其设置为 log...
MAIL_DRIVER=smtp
replace with
用。。。来代替
MAIL_DRIVER=log
回答by Bruce Tong
If anyone encounters this error on L5.8 even after setting your mail driver to 'log' in the env file.
如果有人在 L5.8 上遇到此错误,即使将邮件驱动程序设置为 env 文件中的“登录”。
Swift_TransportException (530) Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required "
Swift_TransportException (530) 预期响应代码 250,但得到代码“530”,消息为“530 5.7.1 Authentication required”
You need to restart your web server, and restart "php artisan serve" as well.
If it still doesn't work, you need to clear the configuration cache with php artisan config:clear
您需要重新启动 Web 服务器,并重新启动“php artisan serve”。如果还是不行,就需要清除配置缓存php artisan config:clear
回答by Dmytro Balytskyi
Laravel use .ENV file!
Laravel 使用 .ENV 文件!
Maybe your edit config\mail.php, try to make edits in the ENV file
也许你的编辑 config\mail.php,尝试在 ENV 文件中进行编辑
Make dump the variable with your current mail configuration
使用您当前的邮件配置转储变量
Put this code in your controller
将此代码放在您的控制器中
dd(config('mail'));
You will see the current settings that the system uses.
您将看到系统使用的当前设置。
回答by iSWORD
One more reason why your MAIL_DRIVER=log
configuration may not be working as expected is that you have your QUEUE_DRIVER
set to something other than sync
.
您的MAIL_DRIVER=log
配置可能无法按预期工作的另一个原因是您的QUEUE_DRIVER
设置不是sync
.
Thanks to the tip by gibex on Laracasts.