If you ever had to direct Devise email notifications to be send asynchronously you know it’s usualy a process that involves some degree of monkey patching.

This week I got tired of repeating this app after app and decided to create a small gem to solve the issue.

I just released devise-async. It lets you easily setup devise to use a proxy mailer that is capable of sending devise’s emails via your preferred queueing backend. It currently supports Resque (default), Sidekiq and Delayed::Job.

To use it you just need to tell devise to use Devise::Async::Proxy as its mailer class.

config.mailer = "Devise::Async::Proxy"

If you use Sidekiq or Delayed::Job you also need to let DeviseAsync knows your taste in config/initializers/devise_async.rb. Don’t botter if you use Resque since it’s the default backend.

Devise::Async.backend = :resque
Devise::Async.backend = :sidekiq
Devise::Async.backend = :delayed_job

Check out the README for more details.


UPDATE: updated classes for new version