multiple recipient in exception_notification

880 Views Asked by At

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" <[email protected]>},
             exception_recipients: %w{[email protected]}
    }
end

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

3

There are 3 best solutions below

1
Philip Hallstrom On

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

exception_recipients: %w{[email protected] [email protected]}

0
Balakishore On

ExceptionNotification::Notifier.exception_recipients = %w([email protected] [email protected]) ExceptionNotification::Notifier.sender_address = %("Exception Notifier" ) ExceptionNotification::Notifier.email_prefix = "[ERROR: Project Name] "

0
AshokGK On

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 => ['[email protected]', '[email protected]'],
        :delivery_method => :smtp,
        :smtp_settings => {
          :user_name => "User Name",
          :password => "Password",
          :domain => "domain",
          :address => "Address",
          :port => 587,
          :authentication => :plain,
          :enable_starttls_auto => true
        }
      }

  end