PHP file Code
function sendTestMail($emailId,$VariableName,$name)
{
$mailer = Mage::getModel('core/email_template_mailer');
$emailInfo = Mage::getModel('core/email_info');
$emailInfo->addTo($emailId, $name);
if ($copyTo && $copyMethod == 'bcc') {
// Add bcc to customer email
foreach ($copyTo as $email) {
$emailInfo->addBcc($email);
}
}
$mailer->addEmailInfo($emailInfo);
// Email copies are sent as separated emails if their copy method is 'copy'
if ($copyTo && $copyMethod == 'copy') {
foreach ($copyTo as $email) {
$emailInfo = Mage::getModel('core/email_info');
$emailInfo->addTo($email);
$mailer->addEmailInfo($emailInfo);
}
}
// Set all required params and send emails
$mailer->setSender(Mage::getStoreConfig('sales_email/order/identity', $storeId));
$mailer->setStoreId($storeId);
$mailer->setTemplateId(1); //"1" is email Template ID
$mailer->setTemplateParams(array(
'customer_name' => $name,
'VariableName' => $VariableValue
)
);
$mailer->send();
return;
}
Code Inside Email Template
Magento Admin >System > Transnational Emails > Select Email Template > Template Content
-
{{var VariableName}}
eg. <span>
{{var VariableName}} </span>