1. in your config.xml define the template before end globel tag like:
<template> <email> <status_changed module="warrantyclaim"> <label>Job Confirmation</label> <file>warrantyclaim/status_changed.html</file> <type>html</type> </status_changed> </email> </template> </global> </config>
2. app/locale/en_US/template/email/warrantyclaim/status_changed.html
<!--@Status updated for claim Id @--> <!--@vars {"var emailId":"Email Id", "var claimId":"Claim Id", } @--> <!--@styles @--> {{template config_path="design/email/header"}} {{inlinecss file="email-inline.css"}} <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="action-content"> <h2>Hi,</h2> <p> Your claim Id : <strong>{{var claimId}} </strong> status has been update please check your claim status using following data. </p> <p><strong>Email Id : </strong>{{var emailId}}</p> <p><strong>Claim Id : </strong>{{var claimId}}</p> <p><a href="{{store url=''}}warranty/?activtab=claim">Check your claim status</a></p> <p> With Regards,<br> VGOD Talent Acquisition </p> </td> </tr> </table> {{template config_path="design/email/footer"}}
3. In your controler file:
if($data['status'] !== $modelnew->getStatus()){ // Send email for Applicant $this->__sendMailToUser($model); } $model->save();
4.In controller create the function
protected function __sendMailToUser($claim){ $senderName = Mage::getStoreConfig('trans_email/ident_custom2/name'); $senderEmail = Mage::getStoreConfig('trans_email/ident_custom2/email'); $mailTemplate = Mage::getModel('core/email_template')->loadDefault('status_changed'); $vars = array( 'claimId' => $claim->getClaimId(), 'emailId' => $claim->getEmailId(), ); $mailTemplate->getProcessedTemplate($vars); $mailTemplate->setSenderName($senderName); $mailTemplate->setSenderEmail($senderEmail); $mailTemplate->setTemplateSubject(Mage::helper('warrantyclaim')->__('Status updated for claim Id : %s',$claim->getClaimId())); $mailTemplate->send($claim->getEmailId(), $claim->getEmailId(), $vars); }
0 Comments