Over the past few days I’ve been working on an application here at work that will be sending emails pretty heavily. Up until now, my usual plan was to just write a couple of helper methods that I could call. These helper methods would undoubtedly use StringBuilder to do most of the grunt work, happily formatting my emails. The problem with this approach, however, should be obvious. There are tons of templates hard coded in C# with string literals all over the place… YUCK!
So I took a step back. I realized that the Rails framework really has this nailed. Through the awesome ActionMailer library within Rails, you can use the built-in template engines to generate emails almost exactly like you would generate a view. This leads to very small helper methods, and it’s just so darn clean. I think the MVC community could use a cool library like this, so I decided to write one.