Managing your application's emails
posted under category: General on April 3, 2009 by Nathan
Here's a recurring problem I've discovered. Many, if not all, of my applications send email, and they tend to do it in an unmanaged, un-object oriented type of way. For instance, if you comment on this blog entry, I and other subscribers are sent an email. The template for this email is tucked away inside a CFC, right below where I insert the record into my database. This, of course, is a problem that can be solved in a repeatable, managed fashion.
I have actually solved this problem before at a previous company I worked at. Obviously all of that code is under lock and key, unusable due to NDAs and basically unethical anyway, so instead, I am planning on recreating something like it, but better, from scratch. Hey, if nothing else, I'll just use it on this blog. Of course I'm talking about open sourcing it - why would I tease readers with a cool toy, and not share it?
Overarching idea: A reusable open source library and API for both the management and sending of emails via templates.
Basic requirements:
- Manage storage of email templates (CRUD basics, consider varying storage options)
- Allow dynamic variables in email templates (Dear #user#)
- Create basic administrative UI, key on easy integration
- Create simple API for sending email
Groupthink questions: Does anyone else do this? How do you solve it? Why have I not heard of anyone else doing it?
Final thoughts: Sending email from your application is a scenario that I see often, and can be handled by an administrative managed, reusable application. Move your email templates out of your code and reduce the complexity of your application.
Oh, and I don't have a name for it yet. I'd hate to call it the Email Template Manager or something stuffy and boring.