【发布时间】:2016-06-01 21:15:07
【问题描述】:
我知道可以在引导文件中设置默认邮件传输,但是如何在 app.ini 文件中设置呢?基本上我想在本地 Windows 系统上使用 smtp 传输,在生产服务器上使用常规邮件传输。
编辑:我已经在 app.ini 中使用了these settings。
谢谢。
【问题讨论】:
标签: zend-framework configuration email
我知道可以在引导文件中设置默认邮件传输,但是如何在 app.ini 文件中设置呢?基本上我想在本地 Windows 系统上使用 smtp 传输,在生产服务器上使用常规邮件传输。
编辑:我已经在 app.ini 中使用了these settings。
谢谢。
【问题讨论】:
标签: zend-framework configuration email
如果你的生产服务器是 *nix
[production]
resources.mail.transport.type = sendmail
[development : production]
resources.mail.transport.type = smtp
resources.mail.transport.host = smtp.example.com
【讨论】:
您可能正在寻找:
resources.mail.transport.register = true ; True by default
完整的例子:如果你在生产中你会使用第一个传输,而在开发中你会使用 development,不是很容易
[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 = john@example.com
resources.mail.defaultFrom.name = "John Doe"
resources.mail.defaultReplyTo.email = Jane@example.com
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 = john@example.com
resources.mail.defaultFrom.name = "John Doe"
resources.mail.defaultReplyTo.email = Jane@example.com
resources.mail.defaultReplyTo.name = "Jane Doe"
来源:http://framework.zend.com/manual/1.12/en/zend.application.available-resources.html
【讨论】:
请注意以下不起作用,它会引发异常:
resources.mail.transport.type = smtp
我们需要使用 Zend_Mail_Transport_Smtp 而不仅仅是 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"
【讨论】: