Laravel 5.1 Mail::send .env 配置不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31603119/
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.1 Mail::send .env configuration doesn't work
提问by MaGnetas
I have a queued job that is supposed to send emails. I keep getting an error:
我有一个排队的作业应该发送电子邮件。我不断收到错误消息:
Swift_TransportException(code: 530): Expected response code 250 but got code \"530\", with message \"530 5.7.1 Authentication required\r\n\" at /my/project/path/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:383
Swift_TransportException(code: 530): 预期响应代码 250,但得到代码 \"530\",消息 \"530 5.7.1 Authentication required\r\n\" at /my/project/path/vendor/swiftmailer/swiftmailer/ lib/classes/Swift/Transport/AbstractSmtpTransport.php:383
I tried using mail
, sendmail
and smtp
drivers. However if I set config values directly via mail.php
in config
dir it seems to work fine.
我尝试使用mail
,sendmail
和smtp
驱动程序。但是,如果我直接通过mail.php
在config
dir 中设置配置值,它似乎工作正常。
Once I get back to .env
configuration it's the same problem again.
一旦我回到.env
配置,它又是同样的问题。
I tried outputting .env
and config
values in my templates - they all seem fine.
我尝试在我的模板中输出.env
和config
值 - 它们看起来都很好。
Any ideas what might be causing this?
任何想法可能导致这种情况?
回答by MaGnetas
The problem was in queue:listener.
问题出在队列中:侦听器。
Spend a lot of time trying to figure out why my config is being replaced with a wrong one.
花很多时间试图弄清楚为什么我的配置被错误的配置所取代。
Finally killing the php artisan queue:listen
process and letting supervisor restart it solved everything.
最后杀死php artisan queue:listen
进程并让主管重新启动它解决了一切。
Still not sure what was causing that. Maybe the .env was cached or something. Restarting the process did the trick.
仍然不确定是什么原因造成的。也许 .env 被缓存或其他东西。重新启动这个过程就成功了。
回答by Karan
It occurs just because your changes are not detected by artisan so it requires restarting artisan. There is nothing to do with php artisan queue:listen
它发生只是因为工匠没有检测到您的更改,因此需要重新启动工匠。没有任何关系php artisan queue:listen