Laravel mail fails because no From address is set
Cannot send message without a sender addressShort answer
Laravel needs a From address for every message. Set a global one in config/mail.php, read from MAIL_FROM_ADDRESS, or set from in the mailable's envelope. If you already set it in .env and nothing changes, the config is cached and the .env file is no longer read: clear it.
Fix it fast
1Find out which cause you have
Print the From address Laravel will really use. An empty or placeholder value points at the cause.
php artisan config:show mail.from2Match what you see, then jump to its fix
- 1
config:show shows an empty address, or the placeholder hello@example.comNo global from address is configuredFix - 2
The .env value is right but config:show still shows the old addressThe configuration is cached, so .env changes are ignoredFix - 3
Most mail works, one mailable sends from the wrong or no addressOne mailable needs its own senderFix
- 1
What does the error look like?
Cannot send message without a sender addressMail sent from Laravel has no From address, or the default hello@example.com
Cause 1 of 3
No global from address is configured
1Check
The global from address in config/mail.php is used whenever the mailable names none. Check what it reads from the environment.
grep -n "MAIL_FROM" .env config/mail.php2Fix
Set the global address and name in the environment file, and make sure config/mail.php reads them.
# .env
MAIL_FROM_ADDRESS="noreply@example.com"
MAIL_FROM_NAME="Example"
// config/mail.php
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],3Verify
config:show prints the new address.
php artisan config:show mail.fromConfirmed by laravel.com
Cause 2 of 3
The configuration is cached, so .env changes are ignored
1Check
Once config:cache has run, the .env file is not loaded during requests or Artisan commands. env() then returns only real system environment variables, and the cached values win.
ls bootstrap/cache/config.php2Fix
Clear the cached configuration, or rebuild it with the new values as part of the deploy. Also call env() only inside config files, never in application code.
php artisan config:clear
# production: rebuild after the change
php artisan config:cache3Verify
config:show now prints the .env address.
php artisan config:show mail.fromConfirmed by laravel.com
Cause 3 of 3
One mailable needs its own sender
1Check
A from set in the mailable overrides the global one. A mailable that builds its envelope without from falls back to the global address.
grep -rn "new Envelope" -A 4 app/Mail/2Fix
Set from in the mailable's envelope.
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Envelope;
public function envelope(): Envelope
{
return new Envelope(
from: new Address('billing@example.com', 'Billing'),
subject: 'Your invoice',
);
}3Verify
Send that mailable and read the From header of the received message.
php artisan tinkerConfirmed by laravel.com
How do I stop it coming back?
- Add MAIL_FROM_ADDRESS to .env.example so every environment has it.
- Use an address on a domain your mail provider has verified.
- Run config:cache in the deploy script after the environment file is updated.
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
Back end
Composer says the gd extension is missing on a Laravel project
composer install or composer update stops on a package that requires ext-gd
Composer refuses to install a package that requires ext-gd when the PHP binary running Composer has no GD extension.
4 causes, each with a fixBack end
composer require maatwebsite/excel fails to install
Composer says the package needs an older PHP than the one installed
Composer refuses maatwebsite/excel when the PHP version or a PHP extension does not match what the package and PhpSpreadsheet need.
3 causes, each with a fixBack end
composer install says the lock file is not compatible and asks for update
Your lock file does not contain a compatible set of packages. Please run composer update.
composer install checked the locked packages against this machine's PHP and extensions and found a conflict.
3 causes, each with a fixBack end
composer require laravel/horizon fails: ext-pcntl is missing
laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system
Horizon needs the pcntl extension, and Composer refuses to install it where PHP lacks that extension.
3 causes, each with a fixBack end
composer require laravel/passport stops with 'requirements could not be resolved'
... but these were not loaded, likely because it conflicts with another require.
Composer found no Passport release that fits your project at once.
4 causes, each with a fixBack end
Composer says the root composer.json requires a PHP version your PHP does not satisfy
Your requirements could not be resolved to an installable set of packages.
Composer compares the php constraint in your composer.json, or in a package, with the PHP that runs Composer.
3 causes, each with a fix