The Dopefly Tech Blog

« The Dopefly Tech Blog Main page

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.

Nathan is a software developer at The Boeing Company in Charleston, SC. He is essentially a big programming nerd. Really, you could say that makes him a nerd among nerds. Aside from making software for the web, he plays with tech toys and likes to think about programming's big picture while speaking at conferences and generally impressing people with massive nerdiness and straight-faced sarcastic humor. Nathan got his programming start writing batch files in DOS. It should go without saying, but these thought and opinions have nothing to do with Boeing in any way.
This blog is also available as an RSS 2.0 feed. Click your heels together and click here to contact Nathan.