Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Email delivery

Laravel says the email was sent, but nothing arrives

ErrorNo exception is thrown and no email arrives

Short answer

Mail::send returns without an error when the message was accepted by the configured mailer, not when it was delivered. Three setups hide the problem: MAIL_MAILER is log, the mail is queued and no queue worker runs, or config is cached so your new .env values are ignored.

  • Applies to Laravel 11, Laravel 12, PHP 8.3
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Look at the mailer and queue values the app actually uses, then at the newest log lines.

    php artisan tinker
    >>> config('mail.default')
    tail -n 40 storage/logs/laravel.log
  2. 2Match what you see, then jump to its fix

    1. 1The email text appears in storage/logs/laravel.log.The log mailer is active, so mail is written to a fileFix
    2. 2The Mailable implements ShouldQueue, or the code calls ->queue(); jobs pile up in the queue table.The mail is queued and no queue worker is runningFix
    3. 3You changed MAIL_* in .env, and config('mail.default') in tinker still shows the old value.Config is cached, so the new .env values are ignoredFix

What does the error look like?

  • No exception is thrown and no email arrives
  • Mail::to($user)->send() returns normally

Cause 1 of 3

The log mailer is active, so mail is written to a file

1Check

The log driver writes each message into the log instead of sending it. It is meant for local development, and a copied .env can carry it to the server.

grep -n "MAIL_MAILER" .env
grep -n "From:" storage/logs/laravel.log | tail -3

2Fix

Set MAIL_MAILER to a real transport such as smtp and fill the MAIL_* values your provider gives you, then clear the cached config.

MAIL_MAILER=smtp

php artisan config:clear

3Verify

Trigger a real mail from the app, such as a password reset, and check the inbox. The message text no longer appears in the log.

tail -n 20 storage/logs/laravel.log

Confirmed by laravel.com

Did this fix it?

Cause 2 of 3

The mail is queued and no queue worker is running

1Check

A queued mail is only a job in the queue. Without php artisan queue:work running, nothing sends it. New apps default to the database queue connection.

grep -n "QUEUE_CONNECTION" .env
php artisan queue:work --once

2Fix

Run a worker and keep it alive with a process monitor such as Supervisor. After each deploy, restart workers because they keep old code in memory.

php artisan queue:work
php artisan queue:restart

3Verify

Queue a new mail and see the job leave the queue and the mail arrive.

php artisan queue:work --once

Confirmed by laravel.com

Did this fix it?

Cause 3 of 3

Config is cached, so the new .env values are ignored

1Check

After php artisan config:cache the .env file is not read during requests. Only the cached values are used.

ls bootstrap/cache/config.php
php artisan tinker
>>> config('mail.default')

2Fix

Clear the cache, or rebuild it after you edit .env.

php artisan config:clear
php artisan config:cache

3Verify

In tinker, config('mail.default') now shows the value you set.

php artisan tinker
>>> config('mail.default')

Confirmed by laravel.com

Did this fix it?

How do I stop it coming back?

  • Keep one .env.example per environment with the real MAIL_MAILER, and review it before every first deploy.
  • Run queue:work under Supervisor and send queue:restart in the deploy script.
  • Run config:cache as the last deploy step so .env changes are not forgotten silently.
  • Send one real test email after each deploy.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Email

PHP mail() returns true but the email never arrives

Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing

mail() returning true only means the message was accepted for delivery, not that it arrived.

4 causes, each with a fix

Email

PHPMailer addCC() adds no CC recipient

The mail arrives for the To address but not for the CC address

addCC() returns false when it rejects the address, and PHPMailer then sends without that CC.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.