/ Published in: PHP
Expand |
Embed | Plain Text
<?php /** * $templateId can be set to numeric or string type value. * You can use Id of transactional emails (found in * "System->Trasactional Emails"). But better practice is * to create a config for this and use xml path to fetch * email template info (whatever from file/db). */ const EMAIL_TEMPLATE_XML_PATH = 'customer/testemail/email_template'; $templateId = Mage::getStoreConfig(EMAIL_TEMPLATE_XML_PATH); $mailSubject = 'HI this is a test mail.'; /** * $sender can be of type string or array. You can set identity of * diffrent Store emails (like 'support', 'sales', etc.) found * in "System->Configuration->General->Store Email Addresses" */ /** * In case of multiple recipient use array here. */ /** * If $name = null, then magento will parse the email id * and use the base part as name. */ $name = 'Asad Rahman'; /* An example how you can pass magento objects and normal variables*/ /* $vars = Array('customer'=>$customer, 'address' =>$address, 'varification_data'=>'fake data for example');*/ /*This is optional*/ $storeId = Mage::app()->getStore()->getId(); $translate = Mage::getSingleton('core/translate'); Mage::getModel('core/email_template') ->setTemplateSubject($mailSubject) ->sendTransactional($templateId, $sender, $email, $name, $vars, $storeId); $translate->setTranslateInline(true); ?>
You need to login to post a comment.
