Несколько получателей в уведомлении об исключении
Я использую драгоценный камень exception_notification с моим приложением rails и хочу отправить сообщение об ошибке по электронной почте на несколько адресов электронной почты. Как я могу это сделать?
config.middleware.use ExceptionNotification::Rack,
email: { email_prefix: "[Ay Error] ",
sender_address: %{"Ay" <adi@yahoo.com>},
exception_recipients: %w{adi1@yahoo.com}
}
end
Я использую почтовый ящик для отправки писем. Я пытался найти в Google, но я не могу найти решение. заранее спасибо
3 ответа
Добавить файл 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
Вы пытались просто добавить его в список? Вот так?
exception_recipients: %w{adi1@yahoo.com foo@example.com}
ExceptionNotification::Notifier.exception_recipients = %w(test1@test.com test2@test.com) ExceptionNotification::Notifier.sender_address = %("Уведомление об исключении") ExceptionNotification::Notifier.email_prefix = "[ОШИБКА: Имя проекта] "