简体   繁体   English

exception_notification中的多个收件人

[英]multiple recipient in exception_notification

I am using exception_notification gem with my rails app and I want to send error report email to multiple email id. 我在Rails应用程序中使用exception_notification gem,我想将错误报告电子邮件发送到多个电子邮件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. 我正在使用mailergem发送电子邮件。 I tried searching on google but i can't find solution. 我尝试在Google上搜索,但找不到解决方案。 Thanks in advance 提前致谢

Add a file config/initializers/exception_notification.rb 添加文件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

Did you try just adding it to the list? 您是否尝试过将其添加到列表中? Like so? 这样吗

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM