I created an email template which appears to be set up correctly. I say this based on it appearing in the System->Transactional Emails section. I tested this by changing the label a few times to make sure and all seemed as it should be.

Issue: when I try to send the email it doesn't send. It is being called from the indexController.php of the same module as the config.xml where I list the email template. The indexController.php itself seems fine to me because it works apart from this.

email template (app/locale/en_US/template/email/sales/new_mto.html)

 <h1>ActiveCodeline custom email example by Branko Ajzele</h1>
  <p>Hi there {{var myvar1}} {{var myvar2}} from {{var myvar3}}. This is just some example template to test custom email module.</p>

config.xml section

 <?xml version="1.0" encoding="UTF-8"?>







            <mto_index_index translate="label" module="mto">
                <label>New MTO</label>



indexController.php (from same module as the config.xml where the email template is referenced above

 $emailTemplate  = Mage::getModel('core/email_template')->loadDefault('new_mto');    
 $emailTemplateVariables = array();
 $emailTemplateVariables['myvar1'] = 'Branko';
 $emailTemplateVariables['myvar2'] = 'Ajzele';
 $emailTemplateVariables['myvar3'] = 'ActiveCodeline';
 $processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables);
 $result = $emailTemplate->send('[email protected]','John Doe', $emailTemplateVariables);
 echo '<br>' . $result;

I have followed this tutorial and looked at some other email questions (which I know have already been asked) but I can't figure out where I'm going wrong.

  • Try loadDefault('new_mto') to loadDefault('mto_index_index'), but I would not recommend using this example because making changes in System->Transactional Emails section will not load the update because you dont have a variable in your system.xml Sep 18, 2014 at 15:19
  • loadDefault('mto_index_index') didn't work. Any links that I could look at with an example of what you mean? @R.S Sep 18, 2014 at 15:38
  • Can you add your full config.xml file Sep 18, 2014 at 16:07
  • @R.S just added it, cheers. Sep 18, 2014 at 16:12
  • 1
    Possible duplicate of New order email confirmation not being sent Jul 26, 2019 at 4:54

1 Answer 1


I changed the email section a little in the config.xml

            <new_mto translate="label" module="mto">
                <label>New MTO</label>

and called it a little differently

 try {
            $storeObj = Mage::getModel('core/store')->load(1);
            $customerEmailId = '[email protected]';
            $customerFName = 'john';
            $customerLName = 'doe';

            $emailTemplate = Mage::getModel('core/email_template')

            $emailTemplateVariables = array();
            $emailTemplateVariables['order'] = '$order';
            $emailTemplateVariables['store'] = '$storeObj';
            $emailTemplateVariables['payment_html'] = '$method';

            $emailTemplate->setTemplateSubject('Add a subject');
            $emailTemplate->send($customerEmailId, $customerFName . $customerLName, $emailTemplateVariables);
            return true;
        } catch (Exception $e) {
            $errorMessage = $e->getMessage();
            return $errorMessage;

This now works for me exactly as I wanted.

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.