I have following custom e-mail templates and want to send them to particular customer.
My magento function as follows but fails to get relevant e-mail template.
$emailTemplate = Mage::getModel('core/email_template')->loadDefault('Newsletter subscription success new');
$mail = Mage::getModel('core/email');
$mail->setToName('John Customer');
$mail->setToEmail('[email protected]');
$mail->setBody($emailTemplate);
$mail->setSubject('The Subject');
$mail->setFromEmail('[email protected]');
$mail->setFromName("Your Name");
$mail->setType('text');// You can use 'html' or 'text'
try {
$mail->send();
Mage::getSingleton('core/session')->addSuccess('Your request has been sent');
$this->_redirect('');
}
catch (Exception $e) {
Mage::getSingleton('core/session')->addError('Unable to send.');
$this->_redirect('');
}
How I get the relevant e-mail template by name?