0

I am using exception_notification gem with my rails app and I want to send error report email to multiple email id. How I can do that ?

config.middleware.use ExceptionNotification::Rack,
    email: { email_prefix: "[Ay Error] ",
             sender_address: %{"Ay" <adi@yahoo.com>},
             exception_recipients: %w{adi1@yahoo.com}
    }
end

I am using mailboxer gem to send emails. I tried searching on google but i can't find solution. Thanks in advance

Adt
  • 495
  • 6
  • 19

3 Answers3

1

Add a file config/initializers/exception_notification.rb

add the following code

    require 'exception_notification/rails'

    ExceptionNotification.configure do |config|

      ##Send notifications if rails running in production mode
      config.ignore_if do |exception, options|
        not Rails.env.production?
      end

      ##add notifier
      config.add_notifier :email, {
        :email_prefix         => "Error Prefix ",
        :sender_address       => "Sender address",
        :exception_recipients => ['developer1@example.com', 'developer2@example2.com'],
        :delivery_method => :smtp,
        :smtp_settings => {
          :user_name => "User Name",
          :password => "Password",
          :domain => "domain",
          :address => "Address",
          :port => 587,
          :authentication => :plain,
          :enable_starttls_auto => true
        }
      }

  end
AshokGK
  • 875
  • 1
  • 10
  • 20
0

Did you try just adding it to the list? Like so?

exception_recipients: %w{adi1@yahoo.com foo@example.com}

Philip Hallstrom
  • 19,673
  • 2
  • 42
  • 46
0

ExceptionNotification::Notifier.exception_recipients = %w(test1@test.com test2@test.com) ExceptionNotification::Notifier.sender_address = %("Exception Notifier" ) ExceptionNotification::Notifier.email_prefix = "[ERROR: Project Name] "

Balakishore
  • 66
  • 1
  • 1
  • 5