lib/delayed/mailer.rb in mail_manager-3.0.0 vs lib/delayed/mailer.rb in mail_manager-3.2.0
- old
+ new
@@ -1,8 +1,12 @@
class Delayed::Mailer < ActionMailer::Base
- def exception_notification(job,error,emails)
- recipients emails
- from Conf.exception_notification['sender_address']
- subject "* [JOB] #{job.name}(#{job.id}) failed on #{`hostname`} in #{Rails.root}"
- body "* [JOB] #{job.name}(#{job.id}) failed with #{error.class.name}: #{error.message} - #{job.attempts} failed attempts\n #{error.backtrace.join("\n ")}"
+ def exception_notification(job)
+ return if MailManager.exception_notification[:to_addresses].blank? ||
+ MailManager.exception_notification[:from_address].blank?
+ mail(to: MailManager.exception_notification[:to_addresses],
+ from: MailManager.exception_notification[:from_address],
+ subject: "* [JOB] #{job.name}(#{job.id}) failed on #{`hostname`} in #{Rails.root}",
+ body: "* [JOB] #{job.name}(#{job.id}) failed with #{job.last_error} - #{
+ job.attempts} failed attempts"
+ )
end
end