Magento发送邮件三次

时间:2016-02-15 07:56:50

标签: email magento smtp shipping

我的Magento默认邮件无效,因此我配置了SMTP来发送邮件。我的所有邮件都可以正常使用SMTP,但发送邮件的次数是三次。

以下是文件路径和代码。

/app/code/local/Mage/Core/Model/Email/Template.php

public function getMail()
{
    if (is_null($this->_mail)) {

        /* changes begin for send mail through smtp */  
         $_helper = Mage::helper('smtp');
         if ($_helper->isEnabled()) {

            $my_smtp_host      = Mage::getStoreConfig('smtp/general/smtp_host');
            $my_smtp_port      = Mage::getStoreConfig('smtp/general/smtp_port');
            $my_smtp_username  = Mage::getStoreConfig('smtp/general/smtp_username');
            $my_smtp_password  = Mage::getStoreConfig('smtp/general/smtp_password');
            $my_smtp_ssl       = Mage::getStoreConfig('smtp/general/smtp_ssl');
            $my_smtp_auth      = Mage::getStoreConfig('smtp/general/smtp_authentication');


            $config = array(
               'ssl' => $my_smtp_ssl,
               'port' => $my_smtp_port,
               'auth' => $my_smtp_auth,
               'username' => $my_smtp_username,
               'password' => $my_smtp_password);

           $transport = new Zend_Mail_Transport_Smtp($my_smtp_host, $config);
           Zend_Mail::setDefaultTransport($transport);
         }
        /* Changes End for send mail through smtp*/

        $this->_mail = new Zend_Mail('utf-8');
    }
    return $this->_mail;
}

我也在send函数中尝试了相同的代码,但没有运气。请建议。谢谢!

0 个答案:

没有答案