535-5.7.8 Username and Password not accepted
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.
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
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
}