Laravel mail fails with 550 5.7.1 Relaying denied
Expected response code "250/251/252" but got code "550", with message "550 5.7.1 Relaying denied"Short answer
The SMTP server you connected to refused to deliver your message, because it does not accept mail from you for that recipient. In Laravel this usually means the mailer talks to the wrong server or sends without login, or uses a From address the account may not send as. Check MAIL_HOST, the login and MAIL_FROM_ADDRESS.
Fix it fast
1Find out which cause you have
Print the mail configuration Laravel really uses. If you ran config:cache, the .env file is no longer read, so this shows the truth.
php artisan config:show mail grep -n '^MAIL_' .env2Match what you see, then jump to its fix
- 1
MAIL_HOST is the default 127.0.0.1, or a hostname of a server that is not your mail providerThe mailer points at a server that does not relay for youFix - 2
MAIL_USERNAME and MAIL_PASSWORD are empty in .envNo SMTP login is sentFix - 3
550 5.7.1 only for some From addresses or some recipient domainsThe sender or recipient is not allowed for this accountFix
- 1
What does the error look like?
Expected response code "250/251/252" but got code "550", with message "550 5.7.1 Relaying denied"Mail works to some recipients and fails with 550 for others
Cause 1 of 3
The mailer points at a server that does not relay for you
1Check
Laravel's stock smtp mailer reads MAIL_HOST (default 127.0.0.1) and MAIL_PORT (default 2525). A local or foreign server that is not set up to relay for your app answers with a relay refusal.
grep -n '^MAIL_' .env2Fix
Set MAIL_HOST and MAIL_PORT to the values your mail provider documents for SMTP submission.
MAIL_MAILER=smtp
MAIL_HOST=smtp.your-provider.example
MAIL_PORT=5873Verify
Clear the cached config, then trigger one real email from the app. The 550 is gone or replaced by a more specific error.
php artisan config:clear && php artisan config:show mailConfirmed by raw.githubusercontent.com
Cause 2 of 3
No SMTP login is sent
1Check
The smtp mailer takes its login from MAIL_USERNAME and MAIL_PASSWORD, and both default to empty. A server whose policy requires authentication will not accept the message from an unauthenticated client (RFC 4954 describes this policy through reply 530 5.7.0, and some servers use a relay refusal instead).
grep -n '^MAIL_USERNAME\|^MAIL_PASSWORD' .env2Fix
Add the SMTP username and password from your provider, then clear the cached config.
MAIL_USERNAME=your-smtp-user
MAIL_PASSWORD=your-smtp-password3Verify
Clear the config cache, confirm the values are loaded, and send again.
php artisan config:clear && php artisan config:show mailConfirmed by rfc-editor.org
Cause 3 of 3
The sender or recipient is not allowed for this account
1Check
Status 5.7.1 means delivery not authorized: the sender is not allowed to send to that destination, which can be the result of per-host or per-recipient filtering (RFC 3463). Compare the From address with the domain your provider has verified for this account.
grep -n '^MAIL_FROM' .env2Fix
Send from an address on a domain verified in your mail account, or ask the provider to allow the recipient domain.
MAIL_FROM_ADDRESS=hello@your-verified-domain.example
MAIL_FROM_NAME="Your App"3Verify
Clear the config cache, then send to one allowed and one other address.
php artisan config:clear && php artisan config:show mailConfirmed by rfc-editor.org
How do I stop it coming back?
- Keep MAIL_* values in .env only, and clear the config cache after every change.
- Use a transactional mail service with a verified sending domain for production.
- Test in staging with a log or sandbox mailer so a bad host is found before launch.
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
Postfix refuses to send with "Relay access denied"
454 4.7.1 <user@example.net>: Relay access denied
Postfix says Relay access denied when a client asks it to deliver to a domain it does not host, and the client is neither listed in mynetworks nor logged in with SASL.
5 causes, each with a fixBack 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 fix