Skip to content


Subversion checkout URL

You can clone with
Download ZIP
PHP mailer class for templated emails
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information. Initial Commit
ta_mailer.php Initial Commit

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.

Something went wrong with that request. Please try again.