heartcombo / devise

Flexible authentication solution for Rails with Warden.
http://blog.plataformatec.com.br/tag/devise/
MIT License
23.85k stars 5.53k forks source link

Support deferred Mailer delivery with `deliver_later` #5610

Open seanpdoyle opened 12 months ago

seanpdoyle commented 12 months ago

Re-opens #4224

By default, all Devise::Models::Authenticatable-initiated Action Mailer deliveries are transmitted immediately (within the request-response cycle).

Transmitting emails and interacting with any third-party services over SMTP or HTTP risk service outages and other types of network-related failures.

This commit adds support for deferring delivery to be done from an Action Job background worker queue through the deliver_later method.

 # config/initializers/devise.rb
Devise.mailer_delivery_method = :deliver_later
imsinu9 commented 11 months ago

@seanpdoyle Do you think we would be able to get this PR merged? Asking this as I am not seeing any activity on this PR.

seanpdoyle commented 10 months ago

@carlosantoniodasilva could you approve the CI workflow for this PR?

carlosantoniodasilva commented 10 months ago

@seanpdoyle Approved it, but there are some test failures in main that I've been looking into, due to some recent merges.

No need to worry about those, I hope to get everything green again soon. (I'm off traveling though, so it might take another couple weeks to circle back on it)

As for the change, I've been wanting to make "later" the default for a while, the current way things work aren't great. I'm not sure about that being an option, haven't given it much thought honestly, but could be a way to migrate over to a new default behavior more easily. Thanks for the PR!

amo13 commented 1 month ago

I was also looking for this exact option. The implementation looks pretty straight-forward. Can we get this merged?