smartinez87 / exception_notification

Exception Notifier Plugin for Rails
http://smartinez87.github.io/exception_notification
MIT License
2.18k stars 415 forks source link

Sinatra Example Not Working #495

Open westonganger opened 4 years ago

westonganger commented 4 years ago

The current Sinatra example is not working. The :smtp_settings are not being applied.

Current Non-Working Documentation:

require "exception_notification"

use ExceptionNotification::Rack,
  email: {
    email_prefix: '[Example] ',
    sender_address: %("notifier" <notifier@example.com>),
    exception_recipients: %w[exceptions@example.com],
    smtp_settings: {
      address: 'localhost',
      port: 1025
    }
  }

Working Version

require "action_mailer"
require "exception_notification"

ActionMailer::Base.smtp_settings = {
  address: 'localhost',
  port: 1025,
}

use ExceptionNotification::Rack,
  email: {
    email_prefix: '[Example] ',
    sender_address: %("notifier" <notifier@example.com>),
    exception_recipients: %w[exceptions@example.com],
  }

I would be happy to create a PR, I assume that it is this line here which is not behaving correctly:

https://github.com/smartinez87/exception_notification/blob/cb6f1bc7e5a2b2ccaebc5a38a80590fb883b195c/lib/exception_notifier/email_notifier.rb#L140

westonganger commented 4 years ago

In Rails I always have to set the following line:

# config/environments/development.rb  

config.action_mailer.smtp_settings = { address: "localhost", port: 1025 }

So its possible that this is an issue in Rails too.