Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 gemfiles
Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 Appraisals
Octocat-spinner-32 Gemfile
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 action_mailer-enqueable.gemspec
README.md

ActionMailer::Enqueable

Drop in support for using queues with existing delivery methods. Works with mailers that accept ActiveRecord, and simple JSON-compatible objects as arguments.

Installation

Add this line to your application's Gemfile:

gem 'action_mailer-enqueable'

Usage

class EnqueableMailer < ActionMailer::Base
  extend ActionMailer::Enqueable

  self.queue = MailRenderingJob

  def welcome(user)
    recipients   'You'
    from         'Me'

    body "Email: Hello, #{user}"
  end

end

class MailRenderingJob

  def self.enqueue(deferred)
    Resque.enqueue(deferred.encoded)
  end

  def self.work(params)
    deferred = ActionMailer::Enqueable::Deferred.from_hash(params)
    deferred.mailer.deliver!
  end

end
Something went wrong with that request. Please try again.