exception_notification中的多个收件人

时间:2015-02-28 17:40:19

标签: ruby-on-rails exception-notification

我在我的rails应用程序中使用exception_notification gem,我想将错误报告电子邮件发送到多个电子邮件ID。我怎么能这样做?

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

我正在使用mailboxer gem发送电子邮件。 我尝试在谷歌搜索,但我找不到解决方案。 提前致谢

3 个答案:

答案 0 :(得分:1)

添加文件 config / initializers / exception_notification.rb

添加以下代码

    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

答案 1 :(得分:0)

您是否尝试将其添加到列表中?像这样?

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

答案 2 :(得分:0)

ExceptionNotification :: Notifier.exception_recipients =%w(test1@test.com test2@test.com) ExceptionNotification :: Notifier.sender_address =%(&#34; Exception Notifier&#34;) ExceptionNotification :: Notifier.email_prefix =&#34; [错误:项目名称]&#34;