Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

fredemagi's avatar

Laravel: Outsending emails with link from application contains wrong url (localhost) in link

It's my first time uploading a Laravel application to the web. I facilitate Laravel Forge and Digital Ocean. I've made an app where users can register them selves. Upon successful registration, an email with an activation link is sent to the user. The problem arises when the user checks the email. The link contains a link to https://127.0.0.1/...

Internal links in the app works correctly. The link in the mail is made with route('example'), where example is the name of a route made in routes/web.php.

The env.file looks something like:

APP_URL=http://SOME_IP_ADDRESS. 

What do I do from here?

In addition, I sent mails to mailtrap. What should I change the mail_host variable to instead in order to send real emails? It looks like:

MAIL_HOST=smtp.mailtrap.io

In advance, thank you.

0 likes
1 reply

Please or to participate in this conversation.