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

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


1.) clear the cache on the server after changing the configuration in the .env file.

php artisan cache:clear;php artisan config:cache;

and if the error still comes

Connection refused is a very explicit and clear error message. It means that the socket connection could not be established because the remote end actively refused to connect.

It's very unlikely that Google is blocking the connection.

It's very likely that your web hosting provider has firewall settings that block outgoing connections on port 465, or that they are blocking SMTP to Gmail. 465 is the "wrong" port for secure SMTP, though it is often used, and Gmail does listen there. Try port 587 instead. If the connection is still refused, call your host and ask them what's up.


If your website URL is http://yourdomain.com

you need to use this port 587

or if your website URL is https://yourdomain.com

you need to use this port 25