I'm going to jump in with related advice that when a web app wants to generate an email as part of a transaction with the user, the email should be added to a queue table of the database, to ensure the event is initiated. Then, come back with a background job that pushes the email from the table to SMTP or Sendgrid or whatever.
Thanks for pointing that one - I wholeheartedly agree.
I now do exactly this but, until recently, I didn't. I'm sure lots of people don't just because it had never occurred to them.
There is a third advantage to add to your list. It is much easier to change the way you send emails. I've started using Send In Blue over SendGrid or SMTP. When I switched a system over from using MIME::Lite, making the change was simple as it only has to happen in one sub of one module.
In reply to Queueing emails (was: Re^2: Module callbacks - to fork or not fork)
by Bod
in thread Module callbacks - to fork or not fork
by Bod
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |