535-5.7.8 Username and Password not accepted
Time flies, the way I do without enabling less secured app
is making a password for specific app
Step one: enable 2FA
- https://myaccount.google.com/signinoptions/two-step-verification/enroll-welcome
Step two: create an app-specific password
- https://myaccount.google.com/apppasswords
After this, put the sixteen digits password to the settings and reload the app, enjoy!
config.action_mailer.smtp_settings = {
...
password: 'HERE', # <---
authentication: 'plain',
enable_starttls_auto: true
}
I had the same problem. Now its working fine after doing below changes.
https://www.google.com/settings/security/lesssecureapps
You should change the "Access for less secure apps" to Enabled (it was enabled, I changed to disabled and than back to enabled). After a while I could send email.
Google stopped allowing apps logging in to Gmail using real password
After 30 May 2022 you can't login with username and password alone to Gmail. Less secure app access is not available anymore unless you have Google Workspace or Google Cloud Identity.
Source: https://support.google.com/accounts/answer/6010255
You need to make a password for specific app
Step one: enable 2FA
- https://myaccount.google.com/signinoptions/two-step-verification/enroll-welcome
Step two: create an app-specific password
- https://myaccount.google.com/apppasswords
After this, use that 16 digit
First, You need to use a valid Gmail account with your credentials.
Second, In my app I don't use TLS auto, try without this line:
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
domain: 'gmail.com',
user_name: '[email protected]',
password: 'YOUR_PASSWORD',
authentication: 'plain'
# enable_starttls_auto: true
# ^ ^ remove this option ^ ^
}
UPDATE: (See answer below for details) now you need to enable "less secure apps" on your Google Account
https://myaccount.google.com/lesssecureapps?pli=1