我知道可以在bootstrap文件中设置默认邮件传输,但是如何在app.ini文件中设置?基本上我想在本地Windows系统上使用smtp传输,在生产服务器上使用常规邮件传输。
编辑:我已在app.ini中使用these settings。
感谢。
答案 0 :(得分:7)
如果您的生产服务器是* nix
[production]
resources.mail.transport.type = sendmail
[development : production]
resources.mail.transport.type = smtp
resources.mail.transport.host = smtp.example.com
答案 1 :(得分: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 = 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
答案 2 :(得分:0)
请注意以下内容不起作用,它会引发异常:
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"