I am not getting Custom email template if i use simple mail function i got a mail what mistake i made here observer.php
class Manoj_Test_Model_Observer {
public function successAfter($observer){
$emailTemplate = Mage::getModel('core/email_template')
->loadDefault('my_custom_email');
$emailTemplate->setDesignConfig(array('area' => 'frontend', 'store' => $iDefaultStoreId));
$emailTemplate->setSenderName(Mage::getStoreConfig('trans_email/ident_general/name'));
$emailTemplate->setSenderEmail(Mage::getStoreConfig('trans_email/ident_general/email'));
$subject=$this->__(' test cubject');
$emailTemplate->setTemplateSubject($subject);
$emailTemplateVariables = array();
$processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables);
$emailTemplate->send('[email protected]','test test', $emailTemplateVariables,$storeId=null);
}
}
config.xml
<config>
<modules>
<Manoj_Test>
<version>0.2.0</version>
</Manoj_Test>
</modules>
<global>
<models>
<test>
<class>Manoj_Test_Model</class>
</test>
</models>
<blocks>
<test>
<class>Manoj_Test_Block</class>
</test>
</blocks>
<helpers>
<test>
<class>Manoj_Test_Helper</class>
</test>
</helpers>
<template>
<email>
<my_custom_email>
<label>Custom email</label>
<file>my_custom_email.html</file>
<type>html</type>
</my_custom_email>
</email>
</template>
<events>
<checkout_onepage_controller_success_action>
<observers>
<marketplace>
<type>singleton</type>
<class>test/observer</class>
<method>successAfter</method>
</marketplace>
</observers>
</checkout_onepage_controller_success_action>
</events>
</global>
<frontend>
<routers>
<test>
<use>standard</use>
<args>
<module>Manoj_Test</module>
<frontName>Test</frontName>
</args>
</test>
</routers>
</frontend>
</config>
my_custom_email.html file path : app/locale/en_US/template/email/my_custom_email.html
<!--@subject My custom email template @-->
<!--@vars
{"store url=\"\"":"Store Url",
"var logo_url":"Email Logo Image Url",
"var logo_alt":"Email Logo Image Alt",
"var data.custom_variable":"Custom variable"}
@-->
<!--@styles
body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
@-->
<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
<tr>
<td align="center" valign="top" style="padding:20px 0 20px 0">
<!-- [ header starts here] -->
<table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
<!-- [ Header starts here] -->
<tr>
<td valign="top">
<a href="{{store url=""}}" style="color:#1E7EC8;"><img src="{{var logo_url}}" alt="{{var logo_alt}}" border="0"/></a>
</td>
</tr>
<!-- [ Header ends here] -->
<!-- [ middle starts here] -->
<tr>
<td valign="top">
<h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">This is my custom email template</h1>
<p style="font-size:12px; line-height:16px; margin:0 0 8px 0;"><strong>My custom variable is :</strong> {{var custom_variable}}</p>
</td>
</tr>
<!-- [middle ends here]-->
<!-- [Footer content starts here] -->
<tr>
<td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
</tr>
<!-- [Footer content ends here] -->
</table>
</td>
</tr>
</table>
</div>
</body>