ZF 1:如何将Zend_Mail Transport设置为代码

时间:2013-05-22 08:13:58

标签: zend-framework zend-mail

我想知道是否有任何方式将此配置从INI移动到bootstrap.php中,这将是全局默认的方式。如果是这样,我该怎么做?我和zend 1.11。

提前感谢。

;resources.mail.transport.type = smtp
;resources.mail.transport.host = "smtp.gmail.com"
;resources.mail.transport.auth = login
;resources.mail.transport.ssl = ssl
;resources.mail.transport.port = 465
;resources.mail.transport.username = email@example.com
;resources.mail.transport.password = pass
;resources.mail.transport.register = true ; True by default
;resources.mail.defaultFrom.email = email@example.com
;resources.mail.defaultFrom.name = "Foo"
;resources.mail.defaultReplyTo.email = email@example.com
;resources.mail.defaultReplyTo.name = "Foo"

[溶液]

实际上它对我来说很有用:

        $config = array(
            'ssl' => $transport_ssl,
            'port' => $transport_port,
            'auth' => $transport_auth,
            'username' => $transport_username,
            'password' => $transport_password,
            'register' => $transport_register,
        );

        $transport = new \Zend_Mail_Transport_Smtp($transport_host, $config);
//        var_dump($transport);exit;
        \Zend_Mail::setDefaultTransport($transport);

0 个答案:

没有答案