Email, Templates, and Perl
I have been meaning to talk about one of my new favorite Perl modules, MIME::Lite::TT::HTML , for quite a while now. As I mentioned in a previous post, there are a bazillion different ways to send an Email message from Perl. This one is just my new favorite.
Here is a short list as to why:
- Can be used for complex multi-part messages and handles attachments easily
- Built upon the equally great MIME::Lite module
- Allows you to easily template your messages using the familiar Template Toolkit package
The templating part is, in my opinion, the important part. How many times have you had to go edit some source code just to change the text or subject of a message? Isn't that just terribly annoying. We use configuration files, MVC with HTML templates, etc, etc. to not hard code things into our apps, but for some reason many people ( myself included for years ) have neglected Email.
Not any longer, I've switched to using this module as my standard way of sending Email these days. If you are interested in learning more about MIME::Lite::TT::HTML, check out my short howto Sending Email with Perl Best Practice on the subject.