devise icon indicating copy to clipboard operation
devise copied to clipboard

Support deferred Mailer delivery with `deliver_later`

Open seanpdoyle opened this issue 2 years ago • 4 comments

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

seanpdoyle avatar Jul 26 '23 14:07 seanpdoyle

@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.

imsinu9 avatar Aug 24 '23 07:08 imsinu9

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

seanpdoyle avatar Sep 22 '23 17:09 seanpdoyle

@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!

carlosantoniodasilva avatar Sep 25 '23 12:09 carlosantoniodasilva

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

amo13 avatar May 31 '24 06:05 amo13