I setup the RoR4-Mailer a long time ago. It works fine. After a while I didn't get emails anymore. I can't remember how I setup it up, so I asked google. After resetup I get an Error as you can see at the bottom.
Can anybody tell me how I configurate it correctly ? (I only want to use the basics. No Devise or any other Gem.)
My Code-Snippets:
/config/initializers/setup_mail.rb:
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
address: "smtp.gmail.com",
port: "587",
domain: "gmail.com",
user_name: ENV["MAIL_USERNAME"],
password: ENV["MAIL_PASSWORD"],
authentication: "plain",
enable_starttls_auto: true,
}
/config/environments/development.rb:
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = true
#default host-url
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => ENV["GMAIL_DOMAIN"],
:authentication => "plain",
:enable_starttls_auto => true,
:user_name => ENV["GMAIL_USERNAME"],
:password => ENV["GMAIL_PASSWORD"]
}
/local_env.yml:
GMAIL_DOMAIN: 'gmail.com'
GMAIL_USERNAME: 'username@gmail.com'
GMAIL_PASSWORD: 'password'
/config/application.rb:
config.before_configuration do
env_file = File.join(Rails.root, 'config', 'local_env.yml')
YAML.load(File.open(env_file)).each do |key, value|
ENV[key.to_s] = value
end if File.exists?(env_file)
end
error-exception:
Net::SMTPAuthenticationError in AuthController#send_pwd_reset_instructions
530-5.5.1 Authentication Required.