Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Recommended delivery type for Rails server

I am wondering the standard practice for delivering emails.

Currently I randomly have:

deliver!
deliver
deliver_now
deliver_later!
deliver_later

I understand the meaning behind these, but I’m wondering what the standard/best practice is for big pro sites?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I am plannig for the worst, in that my amateur code gets hit with heavy usage. I assume deliver_later (no "!") would be best, but would like to confirm before I change all of them.

>Solution :

So the ! methods I basically never use, they ignore the configuration for performing deliveries and raising errors (that I need not to ignore in test/dev), the only time you might want them is for something in CI when you need to alert someone to some problem and you want Rails to ignore the fact that actually sending mail is switched off in test env.

deliver is the old syntax, so haven’t used that in a decade.

So now we’re down to deliver_now and deliver_later. Basically I default to the latter, which sends the email asynchronously, so it’s not hanging up my response waiting for SMTP.

I might use deliver_now somewhere that response time doesn’t matter, like in a background job, although even there I mostly still enqueue it.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading