ActionMailer not using correct smtp_settings with ExceptionNotification

441 Views Asked by At

For some reason it seems like my smtp settings are not being applied. I have them set up in application.rb,

# application.rb     
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :domain               => "blah.com",
  :user_name            => "[email protected]",
  :password             => "pwd",
  :authentication       => 'plain',
  :enable_starttls_auto => true
}

but when I try to send mail (using ExceptionNotification) I'm getting a connect failed error, and some poking around shows me that the settings used by the mail gem are.

{:address=>"localhost", :port=>25, :domain=>"localhost.localdomain", :user_name=>nil, :password=>nil, :authentication=>nil, :enable_starttls_auto=>true, :openssl_verify_mode=>nil, :ssl=>nil, :tls=>nil}

I've never seen this problem with rails (3.2.7) before, so I suspect it's something I'm doing, but I've grepped for other things modifying the settings and I can't find anything. Anybody have any ideas?

1

There are 1 best solutions below

0
On BEST ANSWER

As usual, I spend hours trying to figure out what the problem is, but as soon as I post it on SO, I figure out what's going on :S

I had ExceptionNotifier disabled in dev mode as usual, but the gem is still included, so it still tried to do everything. Apparently the mail configuration was one of the things that wasn't being done.

Solution: enable in dev mode or run in prod.