magento - How to send email with a custom email template -
i creating template abandoned orders. when try use template created, send blank email, more template appears in: system/transactional email
template
the temaplate copy of order_update.html
name test_order_update.html
in en_us/template/email/sales/
config.xml - working
<global> <template> <email> <custom_template module="mymodule"> <label>abandoned transactions</label> <file>sales/test_order_update.html</file> <type>html</type> </custom_template> </email> </template> </global>
shooting - not load template
<?php $storeid = mage::app()->getstore()->getid(); $emailtemplate = mage::getmodel('core/email_template'); $emailtemplate->loaddefault('test_order_update'); $emailtemplate->settemplatesubject('my subject here'); $email = mage::getstoreconfig('trans_email/ident_sales/email'); $name = mage::getstoreconfig('trans_email/ident_sales/name'); $emailtemplate->setsendername($name, $storeid); $emailtemplate->setsenderemail($email, $storeid); $emailtemplatevariables['username'] = ' something'; $emailtemplatevariables['store_url'] = mage::getbaseurl(mage_core_model_store::url_type_web); $emailtemplate->send('myemail@gmail.com', 'name...', $emailtemplatevariables); ?>
email received
sender: sales <sales@example.com> subject: subject here content:
try replacing
$emailtemplate->loaddefault('test_order_update');
with
$emailtemplate->loaddefault('custom_template');
because load email template have give tag name provide in config.xml
also add following line before sending mail
$emailtemplate->getprocessedtemplate($emailtemplatevariables);
if template copy of order_update.html need pass order object teh email parameter.
Comments
Post a Comment