Laravel应用程序URL在发送邮件时无法正常工作 [英] Laravel app URL not working correctly when sending out mails
问题描述
我有一些邮件是使用centos盒子上的cron发送出去的. cron调用console/kernal.php,在其中调用该函数以发送邮件
I have mails that get sent out using a cron on a centos box. The cron calls console/kernal.php where the function get's called to send out the mail
从浏览器中发送邮件时,邮件中的URL正确,但与cron发送时,会将URL更改为localhost
When sending the mail out from within a browser the urls in the mail are correct but when sending with the cron it changes the urls to localhost
我的环境文件中有这个
APP_URL = example.com
APP_URL = example.com
在我的config/app.php
中,我拥有
'url' => env('APP_URL', 'example.com'),
我已尽一切努力来预订我所相信的书.如果我将url env var更改为http://example.com
,则使用正确的url发送电子邮件,然后将整个站点重新发送到http://http//example.com
I've done everything to book I believe. If I change the the url env var to http://example.com
then the emails get sent out with the right url's but then entire site then get's redireted to http://http//example.com
这里出了什么问题.请帮助
What is going wrong here. Please help
编辑
愚蠢的开发人员错误.如果主机不匹配,我有一个中间件正在重定向,因此它将重定向到 http://http//example .com
Stupid dev mistake. I had a middelware that was redirecting if the host did not match so it would then redirect to http://http//example.com
有关此内容和我自己的参考的任何绊脚石,请检查Middelware.对不起,那些想要帮助的人.
For any stumbling upon this and my own reference, check middelware. Sorry to the guys who tried to help.
推荐答案
在.env
APP_URL=http://example.com
在config/app.php
'url' => env('APP_URL', 'http://example.com'),
这篇关于Laravel应用程序URL在发送邮件时无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!