Google SMTP with App password suddenly stopped working March 19 2024

133 Views Asked by At

Nothing in code has changed. I am using Ruby on Rails Action Mailer sending via SMTP Google. I am using an App password, so according to my understanding of their documentations, the sunset of Less Secure Apps in 2024 shouldn't affect me (not to mention, the sunset date is not March 19, 2024 anyway!).

Just to be sure, I have generated a new App password, turned off/on again 2 factor authentication, and it has not fixed the problem.

Critically it's NOT an app backend issue; I am still getting a success response from Google that the email has been sent.

However, it is not appearing in my sent mail, AND importantly, on the App password page, it tells you when the last time the App password was used, and I don't see any usage for the new password and the old password last date was March 18.

The last thing I could think of was at one point Google had a display captcha unlock page that you had to go through... (for when 2FA was off) I tried visiting that page again anyway and Google has turned it off, so I guess it's not relevant anymore. I also tried to do the app password technique with an entirely different Google account - no luck.

I'm not even sure how to troubleshoot this... would love help.

Here's the Action Mailer config, again it should NOT be the problem, I am getting a correct response. Just for kicks, I tested again: port 465 doesn't sent and this has been well documented elsewhere anyway where people needed to switch to 587 to get it to work.

  config.action_mailer.smtp_settings = {
    address: "smtp.gmail.com",
    port: 587,
    domain: "gmail.com",
    authentication: "plain",
    enable_starttls_auto: true,
    user_name: ENV["email_requests"],
    password: ENV["email_requests_password"]
  }
1

There are 1 best solutions below

6
2bob On

It looks like if your Gmail account has 2FA enabled, you'll need to generate an App Password specifically for use with mail clients or applications: https://support.google.com/accounts/answer/185833?hl=en.

Due to security changes, Google SMTP no longer accepts "plain" authentication as of February 15, 2021. However, if you're using an older account or app that doesn't support OAuth 2.0, you might need to temporarily enable "Less Secure App Access" in your Gmail security settings. https://support.google.com/accounts/answer/6010255?hl=en

Hope it helps.