Loads the html file named 'custom_email_template1.html' from
app/locale/en_US/template/email/activecodeline_custom_email1.html
$emailTemplate = Mage::getModel('core/email_template')
->loadDefault('custom_email_template1');
//Create an array of variables to assign to template
$emailTemplateVariables = array();
$emailTemplateVariables['myvar1'] = 'Branko';
$emailTemplateVariables['myvar2'] = 'Ajzele';
$emailTemplateVariables['myvar3'] = 'ActiveCodeline';
/**
* The best part 🙂
* Opens the activecodeline_custom_email1.html, throws in the variable array
* and returns the 'parsed' content that you can use as body of email
*/
$processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables);
/*
* Or you can send the email directly,
* note getProcessedTemplate is called inside send()
*/
$emailTemplate->send('[email protected]','John Doe', $emailTemplateVariables);
you need to add an entry to your config.xml
...
<label>ActiveCodeline custom email module</label>
activecodeline_custom_email1.html
html
...
app/locale/en_US/template/email/activecodeline_custom_email1.html
<!--@subject ActiveCodeline custom email module @-->
Hi there {{var myvar1}} {{var myvar2}} from {{var myvar3}}. This is just some example template to test custom email module...
Source : http://inchoo.net/magento/magento-custom-emails/