Swift_Transportexception Connection Could Not Be Established with Host Smtp.Gmail.Com

Laravel on Localhost - Connection could not be established with host smtp.gmail.com [Connection timed out #110]

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

Connection could not be established with host smtp.gmail.com Network is unreachable #101 error in Laravel email

I solved my problem in cpanel using the code:

change MAIL_DRIVER=smtp to MAIL_DRIVER=sendmail in ".env" file

Connection could not be established with host smtp.gmail.com [Connection refused #111] in laravel 5.6 email send

Problem Solved.
I made the change two things here MAIL_DRIVER and MAIL_PORT.

MAIL_DRIVER=sendmail
MAIL_PORT=587

So, my full code is:

MAIL_DRIVER=sendmail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=myemail@gmail.com
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=ssl

It works fine



Related Topics



Leave a reply



Submit