Php – Connection could not be established with host smtp.gmail.com [Operation timed out #60]

gmaillaravellaravel-5php

I can't sent out any email in my local environment.

I keep getting :

enter image description here
_

.env file.

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=my-email@gmail.com
MAIL_PASSWORD=*****

Note : Surprisingly – I have the same setting in my production server, and it works perfectly.

Any hints / suggestions ?

Best Solution

Update my driver line to

MAIL_DRIVER=sendmail

It works on the first try.

Final .env file should look like this

MAIL_DRIVER=sendmail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=my-email@gmail.com
MAIL_PASSWORD=*****
Related Question