Reputation: 1255
After recently changing my password, my app does not let users send messages which are directed to my gmail. Or maybe, my gmail is possibly not accepting messages from my application? My heroku logs are reporting the following error:
Net::SMTPAuthenticationError (535-5.7.8 Username and Password not accepted.)
I have tried:
• updating the password in the application.yml
file I generated using Figaro.
• heroku restart
.
• ensuring the Allow less secure apps:
is set to ON
in gmail.
• enabling/disabling enable_starttls_auto: true
.
I can see through the heroku console that the message is being saved in the production table. Again, the problem is the message is never received in gmail. This problem is only in production and NOT in development.
config/application.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require(*Rails.groups)
module ChrisPelnarDotCom
class Application < Rails::Application
config.active_record.raise_in_transactional_callbacks = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
domain: 'gmail.com',
user_name: ENV["gmail_username"],
password: ENV["gmail_password"],
authentication: 'plain',
enable_starttls_auto: true }
end
end
setup_mail.rb
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => 'www.yourdomain.com',
:user_name => ENV["gmail_username"],
:password => ENV["gmail_password"],
:authentication => 'plain',
:enable_starttls_auto => true
}
ActionMailer::Base.default_url_options[:host] = ENV["gmail_username"]
config/application.yml
gmail_username: "[email protected]"
gmail_password: "my_password"
Upvotes: 0
Views: 91
Reputation: 2378
You'll also need to update the password in the gmail_password
environment variable in production using heroku config:set gmail_password=YOURNEWPASSWORD --app YOURAPPNAME
. application.yml
should only be getting used in development.
Upvotes: 2