Search code examples
laravelgmail

"Failed to authenticate on SMTP server" after more than 100 emails


I'm trying to send about 500 emails with Laravel, my provider is Gmail. The first 150 emails (more or less) are sent correctly, but after I receive this error:

"Failed to authenticate on SMTP server with username "XXXXXXX" using 3 possible authenticators. Authenticator LOGIN returned Expected response code 250 but got an empty response. Authenticator PLAIN returned Expected response code 250 but got an empty response. Authenticator XOAUTH2 returned Expected response code 250 but got an empty response."

My .env is

MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_ENCRYPTION=ssl
MAIL_USERNAME=...
MAIL_PASSWORD=...

I also tried to wait for about 5 seconds between each email, but it doesn't work. Anyone knows how I can handle this?

Thank you


Solution

  • Try to use the next settings: MAIL_PORT=465 MAIL_ENCRYPTION=ssl

    Enable 2FA in your Google account and create an app password. Use it in MAIL_PASSWORD