Latest posts

magento

send email base

$mail = Mage::getModel('core/email'); $mail->setToName('wang'); $mail->setToEmail('xiaoming@leeroy.ca'); $mail->setBody('Mail Text / Mail Content'); $mail->setSubject('test email magento'); $mail->setFromEmail('xiaoming@leeroy.ca'); $mail->setFromName("wangxiaoming"); $mail->setType('html');// YOu can use Html or text as Mail format $mail->send();

magento

send Magento email by templatee

$templateId = "Fav Email"; $emailTemplate = Mage::getModel('core/email_template')->loadByCode($templateId); $userName='wang'; $productName="test 123"; $receiveEmail='xiaoming@leeroy.ca'; $receiveName=$userName; $vars = array('user_name' => $userName, 'product_name' => $productName,'message'=>'test message'); $emailTemplate->getProcessedTemplate($vars); var_dump($emailTemplate->setSenderEmail(Mage::getStoreConfig('trans_email/ident_general/email', 1))); $emailTemplate->setSenderName(Mage::getStoreConfig('trans_email/ident_general/name', 1)); var_dump($emailTemplate->send($receiveEmail,$receiveName, $vars));