Class: Delayed::Mailer

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
lib/delayed/mailer.rb

Instance Method Summary collapse

Instance Method Details

#exception_notification(job) ⇒ Object



2
3
4
5
6
7
8
9
10
11
# File 'lib/delayed/mailer.rb', line 2

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