您好我一直在尝试使用模板和Zend框架发送magento中的电子邮件。到目前为止,我没有收到一封电子邮件。这就是我所拥有的。
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();
}
}
答案 0 :(得分:0)
未正确安装修补程序。 tk Zachary Schuessler