Overview

Send email with predefined template when resque worker die of any reason.

Folk from https://github.com/anandagrawal84/resque_failed_job_mailer and customizable.

Making it general and seperate from anandagrawal84/resque_failed_job_mailer due to inactive repo.

Installation

gem install resque-failed-job-mailer-2

Or add to Gemfile:

gem 'resque-failed-job-mailer-2'

Usage

All you need to do is configure ActionMailer for smtp details. Add following configuration file resque_failed_job_mailer.rb in config/initializer folder

Resque::Failure::Notifier.configure do |config|
  config.from = '[email protected]' # from address
  config.to = '[email protected]' # to address
  config.include_payload = true # disabled by default for security
  config.include_exception = true # disabled by default for security
  config.tags = ["ProjectX","Wolverine","Resque"] # [ProjectX][Wolverine][Resque] tag displayed in email summary
end

as soon as resque job fail it would send out an email to the configured email address.

Configuration

If you want to use your own email mechanism then add following configuration

Resque::Failure::Notifier.configure do |config|
  config.mailer = ActionMailerClass
  config.mail = ActionMailerMailMethod
  config.from = '[email protected]' # from address
  config.to = '[email protected]' # to address
end

config.mailer is any class that extends ActionMailer::Base

config.mail is mail in class given above in config.mailer