2013-11-25 113 views
1
配置電子郵件

我已經配置應用程序/代碼/核心/法師/核心/型號/電子郵件/ template.php文件Magento的Gmail郵件

$config = array(
      'ssl' => 'tls', 
      'port' => Mage::getStoreConfig('system/smtp/port'), // it is set to 25 
      'auth' => 'login', 
      'username' => '[email protected]', 
      'name' => Mage::getStoreConfig('system/smtp/host'), // it is set to smtp.gmail.com 
      'password' => 'password' 
     ); 

但IM仍然得到例外:

無法發送郵件。 mail():SMTP服務器響應:530 5.7.0必須首先發出STARTTLS命令

其中還需要進行更改才能使其工作?它在別的地方app/code/core/Mage/Core/Model/Email/Template.php

+0

只有你不同於我的方式是我不使用'ssl'=>'tls',在這個數組中。如果你刪除這個呢? –

回答

2

描述的配置是功能性的,用於查看在腳本中的變化來關閉Magento的編譯器的清潔/包括需要/夾。

有支持谷歌Gmail或谷歌Apps的改變的電子郵件功能:

1拷貝文件 「應用程序/代碼/核心/法師/核心/型號/電子郵件/ template.php文件」 到「應用程序/代碼/local/Mage/Core/Model/Email/Template.php

2在文件app /代碼/本地/法師/核心/型號/電子郵件/ 的template.php變化功能:

public function getMail() 
{ 
    if (is_null($this->_mail)) { 
    $my_smtp_host = Mage::getStoreConfig('system/smtp/host'); 
    $my_smtp_port = Mage::getStoreConfig('system/smtp/port'); 
    $config = array(
       'port' => $my_smtp_port, 
       'auth' => 'login', 
       'ssl' => 'tls', 
       'username' => '[email protected]', 
       'password' => 'Abc' 
      ); 
    $transport = new Zend_Mail_Transport_Smtp($my_smtp_host,$config); 
    Zend_Mail::setDefaultTransport($transport);   





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

禁用編譯器,重命名文件夾/包括/在magento root和清除緩存

2

你不應該改變核心。

相反創建自定義模塊,看看@Use any SMTP to send mail in Magento

看一看Send email in magento using your GMail or Google Apps account

+0

我在app/code/local/Mage/Core/Model/Email/Template.php上進行了修改,但問題在於這些修改沒有受到影響,甚至在app/code/core/Mage/Core/Model/Email/Template.php中,沒有其他模塊,哪裏可以點? – Martin

+1

它總是更好(在我看來)創建一個自定義模塊,而不是使用'本地/法師'重寫的東西 –

+1

也我認爲Gmail的SMTP端口是465,而不是端口25 .. http://email.about.com/od /accessinggmail/f/Gmail_SMTP_Settings.htm –