简体   繁体   中英

Laravel app URL not working correctly when sending out mails

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

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

I have this in my env file

APP_URL = example.com

And in my config/app.php I have this

'url' => env('APP_URL', '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

EDIT

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

For any stumbling upon this and my own reference, check middelware. Sorry to the guys who tried to help.

Use full URL with protocol (not only domain) in .env

APP_URL=http://example.com

And in config/app.php

'url' => env('APP_URL', 'http://example.com'),

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM