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)
<div>
<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>
</div>
config.xml section
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Company_Mto>
<version>0.0.1</version>
</Company_Mto>
</modules>
<adminhtml>
<layout>
<updates>
<slider>
<file>mto.xml</file>
</slider>
</updates>
</layout>
</adminhtml>
<frontend>
<routers>
<Mto>
<use>standard</use>
<args>
<module>Company_Mto</module>
<frontName>Mto</frontName>
</args>
</Mto>
</routers>
</frontend>
<global>
<template>
<email>
<mto_index_index translate="label" module="mto">
<label>New MTO</label>
<file>sales/new_mto.html</file>
<type>html</type>
</mto_index_index>
</email>
</template>
<helpers>
<mto>
<class>Company_Mto_Helper</class>
</mto>
</helpers>
</global>
</config>
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('myemail@changedforprivacy.com','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.
loadDefault('new_mto')
toloadDefault('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