You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 25, 2021. It is now read-only.
Repository navigation
How To: Send devise emails in background (Resque, Sidekiq and Delayed::Job)
rchampourlier edited this page Jul 26, 2012
·
3 revisions
Since sending email synchronously is not a good idea, you'll probably want to have Devise enqueuing it's notification emails for background processing.
Although Devise doesn't support this out of the box you can achieve it easily by using the devise-async gem.
To do so, first add it to your Gemfile:
gem"devise-async"
For Devise >= 2.1.1
Include Devise::Async::Model to your Devise model
classUser < ActiveRecord::Basedevise:database_authenticatable,:confirmable# etc ...includeDevise::Async::Model# should be below call to `devise`end
For Devise < 2.1.1
Tell Devise to use the proxy mailer in config/initializers/devise.rb:
# Configure the class responsible to send e-mails.config.mailer="Devise::Async::Proxy"
For all versions
And last but not least, set your queuing backend by creating config/initializers/devise_async.rb: