Saturday, 14 September 2013

Programmatically send emails pass customer vars

Programmatically send emails pass customer vars

I'm working on the custom e-mail sending script which will get customers
details and pass them into e-mail template.
foreach ($emails as $email) {
//send feedback
$customer = Mage::getModel("customer/customer");
$customer->loadByEmail($email);
$emailTemplate =
Mage::getModel('core/email_template')->loadByCode('e-mail templaet
code');
$emailTemplateVariables = array();
$processedTemplate =
$emailTemplate->getProcessedTemplate($emailTemplateVariables);
$emailTemplate->setSenderName('Sender name');
$emailTemplate->setSenderEmail('sender@example.com');
$emailTemplate->setTemplateSubject("email subject");
$emailTemplate->send('mail@example.com','Some name Some surname',
$emailTemplateVariables);
}
Is there any way so I can pass all vars from $customer to
$emailTemplateVariables ?
And those vars will be used as {{var customer.email}} in e-mail template.
Thanks!! Adam

No comments:

Post a Comment