I'm trying to get exception_notification and rails to work together. I have looked at a bunch of other questions, and read through the ReadMe heavily on the exception_notification gem page. However, most other tutorials and questions all seem to be out of date by a year or so, before the major version switch to 4.0. What's extra weird is that the proper emails seem to be getting sent when in development mode, but NOT in production mode, which is where I really want them.
Here's the relevant code:
I installed with gem 'exception_notification'
as it states in the ReadMe.
then... inside config/environments/production.rb
Whatever::Application.configure do
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:user_name => 'blah@blah.com',
:password => 'blahblah',
:authentication => 'plain',
:enable_starttls_auto => true
}
config.action_mailer.perform_deliveries = true
config.action_mailer.default_url_options = {
:host => 'www.blah.com'
}
ActionMailer::Base.default :from => 'BlahApp <reply@blah.com>'
Paperclip.options[:command_path] = "/usr/bin/"
config.middleware.use ExceptionNotification::Rack,
:email => {
:email_prefix => "[Error!] ",
:sender_address => %{<reply@blah.com>},
:exception_recipients => ['"Test Recipient" <tester@blah.com>', '"Test 2" <test2@gmail.com>'],
}
As I said, when I copy/paste this into development.rb, it seems to work properly and send e-mails (though I'm not actually receiving them, Paperclip is catching them and opening them in the browser, and they have what I want in them). Then in production, nothing happens, and when I check the log files, it doesn't appear to be even attempting to send the e-mail. No errors received, except for the one I purposely throw.
I saw there was some issue related to SMTP stuff, so I also tried directly putting the smtp_settings directly into the email config hash of ExceptionNotification (while still having the same settings outside), but no luck with that.
I feel like I'm missing something silly. It's supposed to be dead simple to use. Any thoughts? Much thanks!