Saturday, 16 June 2012

Send Email in magento



 // Transactional Email Template's ID

            $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(Let, $email has recepient information )

            $recepientEmail = $email['emailid'];
            $recepientName = $email['name']." ".$email['surname'];

            // Get Store ID

            $store = Mage::app()->getStore()->getId();

            // Set variables that can be used in email template

            $vars = array('customerName' => $email['name']." ".$email['surname'],
            'customerEmail' => $email['emailid'],'companydetail'=>$email['company_detail']);
            $translate = Mage::getSingleton('core/translate');

            // Send Transactional Email

            Mage::getModel('core/email_template')
            ->sendTransactional($templateId, $sender, $recepientEmail, $recepientName, $vars, $storeId);
            $translate->setTranslateInline(true);






No comments:

Post a Comment