在Magento下发送电子邮件,没有模板


Send email under Magento with out template

你好,我一直试图在magento中发送一封电子邮件,其中没有模板,只是来自Zend框架。到目前为止,我还没有收到一封电子邮件。这是我的东西。

define('MAGENTO', realpath(dirname(__FILE__)));
$new_stock_csv ="var/import/test.co/new_stock.csv";
require_once MAGENTO . '/app/Mage.php';
$currentStore = Mage::app()->getStore()->getId(); 
$mess = "Test of message to be in body."
product_change_email($mess,MAGENTO.$new_stock_csv);
function product_change_email($mess,$file){ 
    $fromEmail = "notice@gmail.com";
    $fromName = "PRODUCT ALERTS";
    $toEmail = "jeremybass@somewhere.net";
    $toName = "Jeremy Bass";
    $body = $mess;
    // body text
    $subject = "Test Subject";
    // subject text
    try{
        $mail = new Zend_Mail();
        $mail->setFrom($fromEmail, $fromName);
        $mail->addTo($toEmail, $toName);
        $mail->setSubject($subject);
        $mail->setBodyHtml($body); // here u also use setBodyText options.
        // this is for to set the file format
        $at = new Zend_Mime_Part($body);
        $at->type        = 'application/csv'; // if u have PDF then it would like -> 'application/pdf'
        $at->disposition = Zend_Mime::DISPOSITION_INLINE;
        $at->encoding    = Zend_Mime::ENCODING_8BIT;
        $at->filename    = $file;
        $mail->addAttachment($at);
        $mail->send();
    }catch(Exception $e){
        echo $e->getMassage();
    }
}

未正确安装后期修复程序。tk Zachary-Schuessler