monstajamss's avatar

Connection could not be established with host smtp.gmail.com :stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465 (Connection timed out)

I am trying to run user email verification in my laravel app.

But i keep getting this error

Connection could not be established with host smtp.gmail.com :stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465 (Connection timed out)

I have this in my .env

MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=password
MAIL_ENCRYPTION=ssl
[email protected]
MAIL_FROM_NAME="${APP_NAME}"

What am i doing wrong

0 likes
23 replies
Snapey's avatar

it was working yesterday? What have you changed?

1 like
monstajamss's avatar

@snapey i did not change anything. That is the exact setting i have in my .env

I am currently hosting my website with linode.

Snapey's avatar

open tinker and enter

>>> config('mail')

check that what you see is your gmail credentials

monstajamss's avatar

@snapey I have this

"smtp" => [
         "transport" => "smtp",
         "host" => "smtp.gmail.com",
         "port" => "465",
         "encryption" => "ssl",
         "username" => "[email protected]",
         "password" => "password",
         "timeout" => null,
         "auth_mode" => null,
       ],
Snapey's avatar

did you see your account name and exact password

monstajamss's avatar

@snapey yeah i did, everything is correct. I still do not know why i am getting this error up till now

monstajamss's avatar

Could it be from my VPS connection? or what could be the cause??

Snapey's avatar

when you dumped the mail config, did it say "default" => "smtp",

viorel's avatar

Do you have 2 factor authentication enabled on your Gmail account?

bilou89's avatar

I have the some problem, it works fine in local, but not in server

nekooee's avatar

@redroseamit I have the same problem. Email is sent from local but not from the server. I tested the link you put and it still gives the same error. Always makes the following error:

redroseamit's avatar

@nekooee it must work because i faced same issue and i am done with same process. If server side its not working please clear the configuration setting cache and also check with ports i am not sure which port you are using .port should not be blocked .i am using shared hosting no clue about VPS.if vps is there some server configuration need to be done.

anuzpandey's avatar

I have the same problem. Locally everything works fine but in the server I have a connection problem.

Connection could not be established with host smtp.googlemail.com :stream_socket_client(): Unable to connect to ssl://smtp.googlemail.com:465 (Permission denied)

Did anyone solve this? Thank you.

zeineb1999's avatar

i have the same problem how did u resolve it please ?

Please or to participate in this conversation.