user image

Jo Micheal
Published in : 2022-01-20

stream_socket_client(): Unable to connect to tcp:// (Network is unreachable)


Swift_TransportExceptionConnection could not be established with host :stream_socket_client(): Unable to connect to tcp:// (Network is unreachable)

I am trying to use SMTP from Gmail with my laravel app but it didn't work when I switched to the live server I am getting this error 

What should I do? here is the .env config which I am uisng{my_email}@gmail.comMAIL_PASSWORD="PASSWORD"MAIL_FROM_NAME="Website"MAIL_FROM_ADDRESS={my_email}@gmail.comMAIL_ENCRYPTION=tls

I tried to change the port to 443 and also i changed tsl to ssl & nothing happen the same error 


Joseph Morgan Date : 2022-01-20

Best answers


Best answers


This config working for me when I am using Server supports HTTPS & SSL when I used a server without SSL (HTTP) it doesn't work until I switched the smtp with "sendmail”


so your configuration should looks like{my_email}@gmail.comMAIL_PASSWORD="PASSWORD"MAIL_FROM_NAME="Website"MAIL_FROM_ADDRESS={my_email}@gmail.comMAIL_ENCRYPTION=tls

Good luck

Jo Micheal Date : 2022-01-20

Wow, this works for me, never heard of sendmail thank you so much

Leave a comment

Join us

Join our community and get the chance to solve your code issues & share your opinion with us

Sign up Now

Related posts

Get user location (city - country) from his IP address
Publish date: 2022-03-02 | Comments: 2
API CORS error in Laravel 9x
Publish date: 2022-08-03 | Comments: 2
[solved] All assets in laravel storage returns 404
Publish date: 2021-12-14 | Comments: 2
tymon/jwt-auth 0.5.12 requires illuminate/support ~5.0
Publish date: 2022-02-18 | Comments: 2