I have a Rails app that uses Gmail to send Actionmailer emails. It has been working great for months, but now that I changed my Gmail password it has stopped working and I get an error:
Net::SMTPAuthenticationError (535-5.7.8 Username and Password not accepted.
I've adjusted the new password in my production.rb and development.rb files:
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
#domain: 'thetens.us',
user_name: '[email protected]',
password: 'mypassword',
authentication: 'plain',
enable_starttls_auto: true }
I'm sure the password is correct. Is there some way to force it to update wherever it's not being updated?
Create a file named as setup_mail.rb in config/initializers/ folder so that it looks like
config/initializers/setup_mail.rb
and put the below code in that file:-
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => 'www.yourdomain.com',
:user_name => "[email protected]",
:password => "mypassword",
:authentication => 'plain',
:enable_starttls_auto => true
}
ActionMailer::Base.default_url_options[:host] = "www.yourdomain.com"