简体   繁体   中英

Swift_TransportException in AbstractSmtpTransport.php line 404: Connection to smtp.gmail.com:465 Timed Out

My goal is to send activation link to my registered users.


Here is settings in my .env file for SMTP

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

Did I missed anything ? I kept getting :

Swift_TransportException in AbstractSmtpTransport.php line 404: Connection to smtp.gmail.com:465 Timed Out

Open your .env file under root project. Edit following Lines in it :

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587 #Update from 465 to 587
MAIL_USERNAME=myemail@gmail.com
MAIL_PASSWORD=yourpassword

Restart local webserver & It worked.

Secure SSL/TLS Settings (Recommended) Outgoing Server: mail.yourdomain.com SMTP Port: 465 But Non-SSL Settings (NOT Recommended) Outgoing Server: mail.yourdomain.com SMTP Port: 587

So use this

MAIL_DRIVER=smtp
MAIL_HOST=mail.yourdomain.com
MAIL_PORT=587 
MAIL_USERNAME=myemail@yourdomain.com
MAIL_PASSWORD=yourpassword

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM