如何检查邮件是否在magento中发送?

时间:2015-02-20 10:51:22

标签: email magento

我的代码:

            $emailTemplate = Mage::getModel('core/email_template')->loadDefault($templateId);
            $senderMail = $order->getCustomerEmail();
            $senderName  = $order->getCustomerName();
            $receiverMail = Mage::helper('orderattachments')->getEmailAddress();
            $receiverName = Mage::helper('orderattachments')->getName();
            $emailTemplate->setTemplateSubject("Order Attachments_ " . $orderId);
            $emailTemplate->setSenderEmail($senderMail, $storeId);
            $emailTemplate->setSenderName($senderName, $storeId);
            $emailTemplate->send($receiverMail,$receiverName, $post);

如何检查邮件是否已发送?

  if(!$emailTemplate->getSentSuccess()) {
            throw new Exception('Not Sent');
        }

是检查这个的正确方法吗?

1 个答案:

答案 0 :(得分:0)

试试这个,

 if(!$emailTemplate->send($receiverMail,$receiverName, $post)) {
        throw new Exception('Not Sent');
    }