2010-10-10 94 views

回答

7

如果您的生產服務器的* nix

[production] 
resources.mail.transport.type = sendmail 
[development : production] 
resources.mail.transport.type = smtp 
resources.mail.transport.host = smtp.example.com 
+0

嘗試使用transport.type = smtp,但我不斷收到異常,Zend顯然不能加載「smtp」我使用Zend Framework 1.12 – Andy 2016-04-28 16:19:42

4

你可以尋找:

resources.mail.transport.register = true ; True by default 

完整的例子:如果你是生產環境中,會使用第一個運輸和在發展,你會使用的開發,很容易不

[production] 
resources.mail.transport.type = smtp 
resources.mail.transport.host = "smtp.example.com" 
resources.mail.transport.auth = login 
resources.mail.transport.username = myUsername 
resources.mail.transport.password = myPassword 
resources.mail.transport.register = true ; True by default 

resources.mail.defaultFrom.email = [email protected] 
resources.mail.defaultFrom.name = "John Doe" 
resources.mail.defaultReplyTo.email = [email protected] 
resources.mail.defaultReplyTo.name = "Jane Doe" 


[development] 
resources.mail.transport.type = smtp 
resources.mail.transport.host = "smtp2.example.com" 
resources.mail.transport.auth = login2 
resources.mail.transport.username = myUsername 
resources.mail.transport.password = myPassword 
resources.mail.transport.register = true ; True by default 

resources.mail.defaultFrom.email = [email protected] 
resources.mail.defaultFrom.name = "John Doe" 
resources.mail.defaultReplyTo.email = [email protected] 
resources.mail.defaultReplyTo.name = "Jane Doe" 

來源:http://framework.zend.com/manual/1.12/en/zend.application.available-resources.html

+0

這正是我在「編輯」中提到的來源。我認爲'註冊'與設置默認值不一樣。 「當實例化一個傳輸時,它會自動註冊到Zend_Mail。雖然通過設置transport.register指令爲FALSE,這種行爲不會發生。」 – understack 2010-10-10 15:09:09

+0

@understack,一旦你有多個傳輸,你可能會注意到它的結果 – tawfekov 2010-10-10 16:50:55

0

當心以下不能正常工作,它拋出一個異常:

resources.mail.transport.type = smtp 

我們需要使用的,而不是唯一的SMTP Zend_Mail_Transport_Smtp對象。請參閱下面的正確答案:

[production] 
resources.mail.transport.type = sendmail 
[development : production] 
resources.mail.transport.type  = Zend_Mail_Transport_Smtp 
resources.mail.transport.host  = "smtp.server.com" 
resources.mail.transport.auth  = login 
resources.mail.transport.username = "myLogin" 
resources.mail.transport.password = "myPasswd" 

來源:http://framework.zend.com/issues/browse/ZF-9802

相關問題