>> Here I'll show you how to use custom transactional mail in Magento. It's very simple, you can use it for your custom page.
=> First create your mail template. Go to Admin=>System=>Transactional Emails=> Click "Add New Template" button. There you'll find a page like :
Select a template from "Template" dropdown. You can use the "Contact Form". Now fill the all require fields and click save template. Now note the "Template Id" of this template.
=> Use this method to send the mail.
public function sendJrTransactionalEmail()
{
// set the Transactional Email Template's ID that you've created...
$templateId = 1;
// Set sender information
$senderName = Mage::getStoreConfig('trans_email/ident_support/name');
$senderEmail = Mage::getStoreConfig('trans_email/ident_support/email');
$sender = array('name' => $senderName,
'email' => $senderEmail);
// Set recepient information
$recepientEmail = 'jayanta@example.com';
$recepientName = 'Jayanta Roy';
// Get Store ID
$storeId = Mage::app()->getStore()->getId();
// Set variables that can be used in email template. To get this variable write like {{var customerEmail}} in transactional Email.
$vars = array('customerEmail' => 'customer@example.com',
'customerName' => 'Mr. John Due');
$translate = Mage::getSingleton('core/translate');
// Send Transactional Email
Mage::getModel('core/email_template')
->addBcc($senderEmail) // You can remove it if you don't need to send bcc
->sendTransactional($templateId, $sender, $recepientEmail, $recepientName, $vars, $storeId);
$translate->setTranslateInline(true);
}
Hope it'll help you........ :)
dynamic and informative blog .,. post ., keep sharing .,.
ReplyDeleteWeb solution indore
Thanks for your comment................
DeleteVery good guide and not so hard to do, just a few steps.
ReplyDeleteNice blog, keep posting content like this .
ReplyDeleteMagento Developers