0

I am trying the following code:

ExceptionNotifier::Notifier.exception_notification(env, exception).deliver

But this message keep on appearing:

A sender (Return-Path, Sender or From) required to send a message

Any idea why this is happening and how I can get around it?

Kamilski81
  • 14,409
  • 33
  • 108
  • 161

1 Answers1

1

You likely have not configured the gem in an initializer. In my controller action for notifying me of an exception I have the following

ExceptionNotifier::Notifier.exception_notification(
  request.env, 
  env["action_dispatch.exception"]
).deliver

I have the following in config/initializers/exception_notifier.rb

if Rails.env.production?
  MyApp::Application.config.middleware.use ExceptionNotifier,
    email_prefix:         "[#{App.domain.pretty}] ",
    sender_address:       App.email.noreply,
    exception_recipients: App.email.exceptions,
    ignore_exceptions:    ExceptionNotifier.default_ignore_exceptions,
    normalize_subject:    true
end

MyApp, and App.____ should all be replaced by your own values.

deefour
  • 34,974
  • 7
  • 97
  • 90