exception_notification icon indicating copy to clipboard operation
exception_notification copied to clipboard

over ride the default email address while sending emails

Open vipulkhullar opened this issue 9 years ago • 1 comments

vipulkhullar avatar Jan 24 '17 12:01 vipulkhullar

you can configure the default email addresses when adding the middleware like this:

options = {
  email: {
    sender_address: %{[email protected]},
    exception_recipients: %w{[email protected]},
  }
}

config.middleware.use ExceptionNotification::Rack, options

and then override them when you manually call ExceptionNotifier.notify_exception

    ExceptionNotifier.notify_exception(
      exception,
      sender_address: %{[email protected]>},
      exception_recipients: %w{[email protected]},
    )

Or if you want to override them for unhandled exceptions, you can set request.env['exception_notifier.options']:

class HomeController < ApplicationController
  before_action :set_exception_notification_options

  def index
    123/0

    render :index
  end

  def set_exception_notification_options
    request.env['exception_notifier.options'] = {
      sender_address: %{[email protected]},
      exception_recipients: %w{[email protected]}
    }
  end
end

EmilioCristalli avatar Apr 21 '19 21:04 EmilioCristalli