I have a Rails 3 App using Devise on Heroku. Problem is I\'m sending emails with Sendgrid and email delivery is slow, it makes the app hang. So I\'m interested in using dela
I'm not sure Devise provides an easy way to do backgrounding of email delivery. However there are ways to be able to do that with DelayedJoy. DelyedJob provides a function "handle_asynchronously" which if injected into the DeviseMailer can ensure that deliveries happen in the background.
Try this in your config/application.rb
config.after_initialize do
::DeviseMailer.handle_asynchronously :deliver_confirmation_instructions
# or
::DeviseMailer.handle_asynchronously :deliver!
end
You will need to experiment with that. You could also try to inherit the DeviseMailer and set it to deliver asynchronously in an initializer in config/initializer/devise_mailer_setup.rb or something to that effect.