In order to have Devise send its emails by background process application Delayed Job just include one line of code after your Devise declaration in your user model. Devise uses one method for all mailers. So all modules make use of it, including extensions like DeviseInvitable (check their code for this method!).
- Code: Select all
class User < ActiveRecord::Base devise :database_authenticatable, :recoverable, :lockable, :trackable, :timeoutable, :invitable # Use delayed job to send emails from Devise and DeviseInvitable handle_asynchronously :send_devise_notification, :queue => 'devise' end
Tested on Rails 3.2.13 with Devise 2.2.4 and Delayed Job 3.0.5