Email code:

$storeId = Mage::app()->getStore()->getId();
        $templateId =     Mage::getStoreConfig(self::XML_PATH_ATTACHMENTS_EMAIL_TEMPLATE);

        $emailTemplate = Mage::getModel('core/email_template')->loadByCode($templateId);

        $vars = array('data' => "hello");
        $a = $emailTemplate->getProcessedTemplate($vars);
        $emailTemplate->setSenderEmail($email, $storeId);
        $emailTemplate->setSenderName("AAA", $storeId);
        $emailTemplate->send($email,"AAA", $vars);

1 Answer 1


If you are loading template using template id than you need to use below code:

$emailTemplate = Mage::getModel('core/email_template')->load($emailTemplateId);

Also please check that your template is loading or not:

If its not loading try to loading it by passing it static value as tempalte id

Also check that you are using "data" in template file:

  • not working....
    – ND17
    Commented Feb 6, 2015 at 8:35
  • template is loading n i m using data in template file like this {{var data}} n using static value still email is empty
    – ND17
    Commented Feb 6, 2015 at 8:43
  • The static content of template coming or not? Commented Feb 6, 2015 at 8:46
  • its not coming a static content of template
    – ND17
    Commented Feb 6, 2015 at 8:50
  • please check that you have created the html of template on below path: app/locale/[your_locale_or_en_US]/template/email/[email_template_filename].html Commented Feb 6, 2015 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.