简体   繁体   中英

Cannot send email from Laravel app in production

I'm trying to send emails from Laravel app that I have in production, but it's not working. It gives me this error:

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

But when I try to send email from localhost it works correctly.

my config mail

  1. MAIL_DRIVER=smtp
  2. MAIL_HOST=smtp.googlemail.com
  3. MAIL_PORT=465
  4. MAIL_USERNAME=*********
  5. MAIL_PASSWORD=**********
  6. MAIL_ENCRYPTION=ssl

also email is less secure:on

did you tried it out?

Using gmail smtp via Laravel: Connection could not be established with host smtp.gmail.com [Connection timed out #110]

Also make sure your if your gmail account has 2 factor authentication enabled or not.

If there is any two factor authentication enabled in your account then you can use App specific password from google account page.

There are lots of services you can use like Sendinblue, sendgrid etc.

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