I am trying to use Mailgun
'driver' => env('MAIL_DRIVER', 'mailgun'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
MAILGUN_DOMAIN=xxxxxxxxxx,
MAILGUN_SECRET=xxxxxxxxxx,
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
The error is a strange one. Why would it be trying to connect to gmail?
Connection could not be established with host smtp.gmail.com [Connection timed out #110]
Edit:
Now I am getting
"mail" => array:9 [▼
"driver" => "smtp"
"host" => "smtp.mailgun.org"
"port" => "2525"
"from" => array:2 [▶]
"encryption" => null
"username" => null
"password" => null
"sendmail" => "/usr/sbin/sendmail -bs"
"markdown" => array:2 [▼
"theme" => "default"
My MAIL_HOST was mailtrap.io
, and it seems that that URL is not valid any more.
When I changed it to smtp.mailtrap.io
it started working again.
It's look like your .ENV
still have cache.
Please try this way
php artisan config:cache
php artisan cache:clear
And try to debug at your Controller
dd(env('MAIL_HOST'));
If it's still get smtp.gmail.com
. Please try this way.
Edit your config/app.php
. And add below 'env' => env('APP_ENV', 'production'),
'mail_host' => env('MAIL_HOST', 'smtp.mailgun.org'),
And try to debug at your Controller
dd(config('app.mail_host'));
I'm sure it's will show smtp.mailgun.org
After that you can delete the line you has just added to config/app.php
In your .env
file you should set
MAIL_HOST=smtp.mailgun.org
MAIL_USERNAME=(yourmailgunusername)
MAIL_PASSWORD=(yourmailgunpassword)
MAIL_PORT=587
MAIL_DRIVER=mailgun
You can refer to these tutorials for more informations
Mailgun setup with Laravel 5 example
Ultimate Guide on Sending Email in Laravel
After
php artisan config:cache
php artisan cache:clear
You probably also need to restart your web server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With