Han Hsu
Han Hsu

Reputation: 23

Laravel 8 Send Mail by Gmail get stream_socket_client(): unable to connect to tcp://smtp.gmail.com:587 (Connection timed out)

I have tried send mail by

MAIL_PORT=587 MAIL_ENCRYPTION=tls

AND

MAIL_PORT=465 MAIL_ENCRYPTION=ssl

And I allow the option "less secure app"

But always get this notification: Connection could not be established with host smtp.gmail.com :stream_socket_client(): unable to connect to tcp://smtp.gmail.com:587 (Connection timed out)

My Laravel Version is Laravel Framework 8.34.0 and using ubuntu 18.04

How can I fix this problem Thanks everyone

Upvotes: 0

Views: 441

Answers (1)

Priesten
Priesten

Reputation: 81

I faced a similar issue on my local setup of a Laravel 8 project. Much of the search I did did not solve the issue and as a last resort I tried sending the mail with a VPN and it worked.

So try with a VPN. I am using Betternet

Upvotes: 0

Related Questions