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