Hi, nikhaldi
I wrote a custom email notifier:
module ExceptionNotifier
class DynamicEmailNotifier < EmailNotifier
def call(exception, options={})
options.reverse_merge!(exception_recipients: Admin.where(notified: true).pluck(:email))
super
end
end
end
and added the following configuration to config/environments/<env>:
Rails.application.configure do
# ...
config.middleware.use ExceptionNotification::Rack,
dynamic_email: {
email_prefix: '[EDM2] ',
sender_address: 'Admin <admin@zzz.zz>',
# Override default action mailer settings.
delivery_method: :smtp,
smtp_settings: {
address: '127.0.0.1',
port: 25,
user_name: 'admin@zzz.zz',
password: Rails.application.secrets[:sender_password],
authentication: :plain,
enable_starttls_auto: true,
openssl_verify_mode: 'none'
}
}
ExceptionNotifier::Rake.configure
end
It works well when the exceptions are triggered by the HTTP requests, but when the exceptions are from rake tasks, no email is sent, and there is no record in maillog indicating that any email delivery has been tried.
Hi, nikhaldi
I wrote a custom email notifier:
and added the following configuration to
config/environments/<env>:It works well when the exceptions are triggered by the HTTP requests, but when the exceptions are from rake tasks, no email is sent, and there is no record in maillog indicating that any email delivery has been tried.