PHP mailer class for templated emails
Latest commit 319ba3b Sep 30, 2010 @tarnfeld Initial Commit
Failed to load latest commit information.

TA_Mailer Class

This handy PHP class makes it really easy to implement templated emails. It's simple, just specify the template folder, add the template (or you could extend the class to set these as defaults – which is what I do) and then add some data! Here is a quick example below.

$mailer = new TA_Mailer();

$data = array( "name" => "Tom", "awesomeness" => "100%" );



We are using an associative array to send in the tag => value to the mailer. Here is what emails/welcome.html would look like.

Hey there {name}!

Guess what, your submission to The Most Awesomeness Guy has been accepted and rated! We think your {awesomeness} awesome!


There are plenty of applications for this, if you don't want to use the php mail() function you could extend the methods (as documented in the class file) and use it for which I've already done!

Enjoy, Tom.