<?php
$mailer = Mage::getModel('core/email_template_mailer');
$emailInfo = Mage::getModel('core/email_info');
$emailInfo->addTo($customerEmail, $customerName);
$mailer->addEmailInfo($emailInfo);
$mailer->setSender(Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId));
$mailer->setStoreId($storeId);
$mailer->setTemplateId($templateId);
$mailer->setTemplateParams(array(
'object' => $object,
)
);
$emailTemplate = Mage::getModel('core/email_template');
$xml = '';
$mail = $emailTemplate->getMail();
$attachment = $mail->createAttachment($xml);
$attachment->type = 'text/xml';
$attachment->disposition = Zend_Mime::DISPOSITION_INLINE;
$attachment->encoding = Zend_Mime::ENCODING_BASE64;
$attachment->filename = 'test.xml';
try{
$emailTemplate->setDesignConfig(array('area' => 'frontend', 'store' => $mailer->getStoreId()))
->sendTransactional(
$mailer->getTemplateId(),
$mailer->getSender(),
$emailInfo->getToEmails(),
$emailInfo->getToNames(),
$mailer->getTemplateParams(),
$mailer->getStoreId()
);
}
catch(Exception $e)
{
Mage::log($e->getMessage(), null, 'Error.log');
}
?>