1
votes

It worked for my other Gmail account 5 minutes ago so I know my config is all correct but now I'm getting an authentication error. I just made a new Gmail account and changed the username and password in my development.rb file and now it doesn't work.

config.action_mailer.default_url_options = { host: "locahost:3000" }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
   :address              => "smtp.gmail.com",
   :port                 => 587,
   :enable_starttls_auto => true,
   :user_name            => ENV['gmail_username'],
   :password             => ENV['gmail_password'],
   :domain               => 'localhost',
   :authentication       => :plain
}

This thread helped me last time but like I said I don't know what else to try..? Net::SMTPAuthenticationError when sending email from Rails app (on staging environment)

For my new Gmail account two-factor authentication is OFF, I turned ON the setting to allow less secure apps as I had to for my other account. AND I also went here https://accounts.google.com/DisplayUnlockCaptcha and allowed account access. Not sure what I missed...Probably something stupid.

1

1 Answers

1
votes

If two-factor authentication is ON go to the app passwords section, then in the first select choose "Other (custom name)", enter the name of your application and click "generate". After that you get a pop-up with the password you have to use in your action mailer settings.

*if two-factor authentication is OFF, enable it first.