trying to send email programmaticaly with order items grid using {{layout handle="sales_email_order_items" order=$order}}
but its not working. {{htmlescape var=$order.getCustomerName()}}
show customer name properly.
what is missing?
following is code for email and 29 is id of template in which {{layout handle="sales_email_order_items" order=$order}}
is mentioned.
Mage::app()->getLocale()->emulate($storeId);
$SalesOrder = Mage::getModel("sales/order")->load($requestParams['order_id']);
$storeEmail = Mage::getStoreConfig('trans_email/ident_custom1/email');
$storeName = Mage::getStoreConfig('trans_email/ident_custom1/name');
$recvEmail = $CustomerName;
$recvName = $email;
$templateId = 29;
//set data to use in array
$edata['comment'] = $ResultData->URL;
$edata['order'] = $SalesOrder;
//Core email sending code
$emailTemplate = Mage::getModel('core/email_template')->
addBcc('[email protected]')->
sendTransactional($templateId);
$emailTemplate->getProcessedTemplate($edata);
$emailTemplate->setSenderEmail($storeEmail);
$emailTemplate->setSenderName($storeName);
$emailTemplate->setType('html');
$emailTemplate->send($recvEmail,$recvName,$edata);
Thanks in advance.
Note: If you know any good tutorial on sending email programmatically with ordered item grid. please tell me.