I am fighting with this issue the whole afternoon.
I used this gem:
gem 'exception_notification'
and then I put this to the /config/environments/production.rb
file:
config.action_mailer.default_url_options = { :host => 'http://www.website.com' }
config.action_mailer.delivery_method = :sendmail
# Defaults to:
# config.action_mailer.sendmail_settings = {
# location: '/usr/sbin/sendmail',
# arguments: '-i -t'
# }
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
#config.action_mailer.default_options = {from: 'admin@website.com'}
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "gmail.com",
:user_name => "myemail@gmail.com",
:password => "password",
:authentication => "plain",
:enable_starttls_auto => true
}
config.middleware.use ExceptionNotification::Rack,
:email => {
:email_prefix => "[App Error] ",
:sender_address => %{"notifier" <myemail@gmail.com>},
:exception_recipients => %w{error_email@gmail.com}
}
But it didn't work out.
So I tried to put it to the /config/application.rb
file:
...
module MyApp
class Application < Rails::Application
...
config.middleware.use ExceptionNotification::Rack,
:email => {
:email_prefix => "[App Error] ",
:sender_address => %{"notifier" <myemail@gmail.com>},
:exception_recipients => %w{error_email@gmail.com}
}
end
end
How I am testing it - I put to the URL not existing ID, for example /users/1000000
. But I don't receive any email with this error to my inbox.
Could anyone help me out with this issue?
Thank you guys.
I know this is kind of an old post, but I might have an answer. You have two configs for action_mailer in your production config:
config.action_mailer.delivery_method = :sendmail
# and also...
config.action_mailer.delivery_method = :smtp
Might want to remove one of them.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.