Laravel Mail Not Sending? 8 Fixes That Actually Work
Laravel Mail Not Sending? 8 Fixes That Actually Work Meta description: Laravel mail not sending? Follow these 8 simple fixes for SMTP, .env, cache, queue and Gmail problems. Step-by-step guide with code. URL slug: lar
Laravel Mail Not Sending? 8 Fixes That Actually Work
Meta description: Laravel mail not sending? Follow these 8 simple fixes for SMTP, .env, cache, queue and Gmail problems. Step-by-step guide with code.
URL slug: laravel-mail-not-sending
If your Laravel mail is not sending, you are not alone. It is one of the most common problems in Laravel projects. The code looks right, there is no clear error, but the email never arrives.
The good news is that the cause is usually small. In this guide, you will check the most common causes in order, from the easiest to the hardest. Most people fix the problem in the first three steps.
Quick Checklist
Before you read the details, check these first:
- Is your
.envfile correct? - Did you clear the config cache?
- Are your port and encryption matching?
- Are you using a queue without running the worker?
- Are you using a Gmail normal password instead of an App Password?
Now let's fix each one.
1. Check Your .env Mail Settings
Open your .env file and check these values:
MAIL_MAILER=smtp
MAIL_HOST=smtp.example.com
MAIL_PORT=587
MAIL_USERNAME=your-username
MAIL_PASSWORD=your-password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"
Common mistakes:
- A wrong host name, or a typo in the username.
-
MAIL_MAILERis set tologorarray. These do not send real emails. - Your password has special characters like
#or a space. Put the password inside quotes:MAIL_PASSWORD="my#pass word".
2. Clear the Config Cache
Laravel can keep old settings in its cache. If you changed .env but nothing changed, run:
php artisan config:clear
php artisan cache:clear
If your site is in production and you use config:cache, run this after clearing:
php artisan config:cache
This is the number one reason why a correct .env still does not work.
3. Match the Port and Encryption
Your port and encryption must match your mail provider. These are the common pairs:
| Port | Encryption |
|---|---|
| 587 | TLS |
| 465 | SSL |
| 25 | None (often blocked) |
If you use the wrong pair, the connection fails or times out. Check your provider's documentation. Also check your config/mail.php file, because newer Laravel versions may use slightly different setting names.
4. Use a Gmail App Password
If you use Gmail SMTP, your normal Gmail password will not work. Google blocks it.
Do this instead:
- Turn on 2-Step Verification in your Google account.
- Create an App Password.
- Put the App Password in
MAIL_PASSWORD.
Use smtp.gmail.com as the host and port 587 with TLS.
5. Run the Queue Worker
If your mail class uses ShouldQueue, or you use Mail::queue(), the email goes to a queue first. It will not send until a worker runs.
php artisan queue:work
Also check QUEUE_CONNECTION in .env. If it is sync, mail sends right away. If it is database or redis, you need a running worker.
On a live server, use Supervisor so the worker keeps running after you close the terminal. After you change code, restart the worker:
php artisan queue:restart
6. Read the Laravel Log
Laravel writes errors to this file:
storage/logs/laravel.log
Open the last lines. Look for words like "Connection could not be established", "Authentication failed" or "Connection timed out". The message tells you exactly where the problem is.
You can also test without sending a real email. Set MAIL_MAILER=log, send a mail, and check the log file. If the email text shows there, your Laravel code is fine and the problem is your SMTP settings.
7. Test with Tinker
Test your mail setup without writing any controller code:
php artisan tinker
Then run:
Mail::raw('Test email', function ($message) {
$message->to('[email protected]')->subject('Test');
});
If this works, your SMTP is fine. The problem is in your own mail class, your queue or your event. If it fails, read the error message. It will point to the SMTP problem.
8. Check Server Blocks, Spam and Domain Settings
If everything above is correct, check these:
- Blocked port: Many shared hosts and cloud servers block port 25 or 465. Ask your host if outgoing SMTP ports are open.
- Spam folder: The email may be sent but sitting in spam.
- From address: Use an email on your own domain. Some providers reject mail from an address they do not own.
- SPF and DKIM: Add these records in your domain DNS. Without them, Gmail and Outlook may reject or hide your emails.
Final Tips
- Change only one thing at a time, then test again.
- Use a testing tool like Mailtrap in local development, so you never send test emails to real people.
- Keep your mail settings in
.env, never inside your code.
Still Stuck?
Some mail problems depend on your server, your hosting or your DNS, and they take time to find. If your Laravel mail is still not sending, I can check and fix it for you.
I am a Laravel developer. I fix SMTP, queue, 500 error and other Laravel bugs. Send me a screenshot of your error here: Hire me on Fiverr
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.