Skip to main content
Laravel’s built-in mail system supports SMTP out of the box. Point it to mySMTP by editing your environment file and clearing the configuration cache.

Prerequisites

SMTP settings

Shared IP plans are only available to customers in Denmark.

Configure Laravel SMTP

1

Update .env

Open .env in the root of your Laravel project and set the mail variables. Use the version-specific encryption setting:
For Laravel 11 and later, set MAIL_SCHEME=tls instead of MAIL_ENCRYPTION:
For Laravel 10 and earlier, set:
2

Clear config cache

Run the following command so Laravel picks up the new values:
3

Send a test email with Tinker

Start Tinker:
Then run:
Check your inbox for the message.
Do not commit .env files with real passwords to version control. Load credentials from environment variables, or use Laravel’s encrypted environment files (Laravel 11+) when possible.

Troubleshooting

Make sure you are using your real mySMTP hostname (not relayxx.mysmtp.com). Check that your server allows outbound connections on port 587. If the port is blocked, try 2525 or 465.
Re-enter your mySMTP username and password in .env, then run php artisan config:clear again. Verify there are no extra spaces or quotes.
Verify SPF, DKIM, and DMARC are configured for your sending domain. See DNS settings quick explainer and SPF, DKIM, DMARC, and BIMI explained.
Run the Sender Readiness Checklist and Email Header Analyzer in the mySMTP Deliverability Toolbox.
Check your Laravel logs (storage/logs/laravel.log) for SMTP error details. Also confirm MAIL_FROM_ADDRESS uses a domain authenticated with mySMTP.