Tuesday, September 13, 2011

Send mail from magento

$mail = Mage::getModel('core/email');
$mail->setToName('Your Name');
$mail->setToEmail('Youe Email');
$mail->setBody('Mail Text / Mail Content');
$mail->setSubject('Mail Subject');
$mail->setFromEmail('Sender Mail Id');
$mail->setFromName("Msg to Show on Subject");
$mail->setType('html');// YOu can use Html or text as Mail format
$mail->send();
?>

also you can use

$emailTemplate  = Mage::getModel('core/email_template')->load(1);   //1 is Transactional Emails id
$emailTemplate->setSenderEmail('sapnandu@gmail.com');
$emailTemplate->setSenderName('Sapnandu');
$emailTemplate->send('sourav.m@gsl.in','John', '');

look on
http://stackoverflow.com/questions/5595202/sending-e-mail-programmatically-in-magento-is-failing

2 comments:

  1. Hello,

    Great help for send email using custom template in magento at following url :

    http://www.webslike.com/Thread-How-to-send-an-email-with-custom-template-in-magento

    ReplyDelete
  2. This is a great post. I like this topic.This site has lots of advantage. It helps me in many ways.Thanks for posting this again.
    magento development company in bangalore 

    ReplyDelete