Email code:

public function getNotification() {

    return Mage::getStoreConfig('example/general/notification');

public function sendEmail() { 
$storeId = Mage::app()->getStore()->getId();
        $templateId = Mage::helper('example')->getNotification();
        $emailTemplate = Mage::getModel('core/email_template')->loadDefault($templateId);
        $senderMail = Mage::helper('example')->getEmailAddress();
        $senderName  = Mage::helper('example')->getName();
        $receiver = array(
                $senderMail => $senderName,
                $authorMail => $authorName

        $emailTemplate->setTemplateSubject("New Notification Added For ". $productName);
        $emailTemplate->setSenderEmail($senderMail, $storeId);
        $emailTemplate->setSenderName($senderName, $storeId);
        $emailTemplate->send(array_keys($receiver),array_values($receiver), $post);

my code in config.xml

                <general_notification translate="label" module="example">



<label>Notification send to admin and customer</label>



Now In System > Transaction Email I m add New template and save that template In config I m get template name but using this template my mail is send but Email is empty. there is no content display

2 Answers 2


I m just change my email method

const XML_PATH_EMAIL_CONTRACT_NOTIFICATION = 'example/general/notification';

 public function sendEmail() { 
 $translate = Mage::getSingleton('core/translate');
          $mailTemplate = Mage::getModel('core/email_template');
          $templateConfigPath = self::XML_PATH_EMAIL_CONTRACT_NOTIFICATION;
          $receiverMail= '[email protected]';
          $senderMail = Mage::helper('example')->getEmailAddress();
            $senderName  = Mage::helper('example')->getName();

          $sentFrom = array('email'=>$senderMail,'name'=>$senderName);
          $template = Mage::getStoreConfig($templateConfigPath, Mage::app()->getStore()->getId());
          $mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>Mage::app()->getStore()->getId()))

This is work for me hope so this will help other


you can use load function for this like below

$this->_email_template = 'id of template' // int

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

 $vars = array('ReviewURL' => $ReviewUrl,
                            'ProductName' => $productName,
                            'url' => $productUrl,
                            'ProductImage' => $productImage,


                        $from = $this->getFromMail($this->_identity);

                        $billingAddress = $order->getBillingAddress();
                        $success_flag = $emailTemplate->send($order->getCustomerEmail(), $billingAddress->getFirstname(), $vars);

hope this will work for you

  • not working....
    – ND17
    Commented Apr 15, 2015 at 12:24
  • recheck your template path in config.xml
    – liyakat
    Commented Apr 15, 2015 at 12:25
  • which path i cant understand . i write code for email in above. is there any other code write in config.xml?
    – ND17
    Commented Apr 15, 2015 at 12:35
  • are you able to see your template name in admin ?
    – liyakat
    Commented Apr 15, 2015 at 12:48
  • In System > Transaction Email > New Email Template? if yes there is no template name
    – ND17
    Commented Apr 15, 2015 at 12:55

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.