magento 发送邮件

magento 发送邮件

精简版

public function sendMailsAction(){
     $mail = Mage::getModel('core/email'); 
     $mail->setToName('Your Name'); 
     $mail->setToEmail('1050653098@qq.com'); 
     $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 
    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(''); 
    }  
}

发表评论

发表评论

*

沙发空缺中,还不快抢~