user image

Eslam Zedan
Published in : 2022-02-16

Laravel Network is unreachable stream_socket_client 587


I have an error while trying to send email from gmail by laravel.

my env setting:


The error that appears:

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


Mohamed Atef Date : 2022-02-16

Best answers


Best answers


Probably you are using your personal password but you need a password called “App password” you can get it from your gmail account > security > app password

Eslam Zedan Date : 2022-02-16

thank you for your replay 

it is working fine on my local PC


Yasen Sayed Date : 2022-02-21

Best answers


Best answers


Hello Islam, 


You should use the host configuration of the host you are using for example create a new email that looks like this

The next step goes to your host mail config and takes this config into your env file.

Finally, try to clear the config cache and send a test email with these commands.

php artisan config:clear && php artisan config:cache

Eslam Zedan Date : 2022-02-21

Thank you

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

How can I use arabic words, paragraphs in the faker?
Publish date: 2022-03-06 | Comments: 1
How to pass valiables to 404 error page in laravel?
Publish date: 2022-02-21 | Comments: 2
Laravel error 419 page expired
Publish date: 2021-04-10 | Comments: 2
tymon/jwt-auth 0.5.12 requires illuminate/support ~5.0
Publish date: 2022-02-18 | Comments: 2