发布于 2015-10-07 09:55:55 | 88 次阅读 | 评论: 0 | 来源: 网络整理

25.13. Securing SMTP Transport

Zend_Mail also supports the use of either TLS or SSL to secure a SMTP connection. This can be enabled be passing the 'ssl' parameter to the configuration array in the Zend_Mail_Transport_Smtp constructor with a value of either 'ssl' or 'tls'. A port can optionally be supplied, otherwise it defaults to 25 for TLS or 465 for SSL.

例 25.12. Enabling a secure connection within Zend_Mail_Transport_Smtp

$config = array('ssl' => 'tls',
                'port' => 25); // Optional port number supplied

$transport = new Zend_Mail_Transport_Smtp('mail.server.com', $config);

$mail = new Zend_Mail();
$mail->setBodyText('This is the text of the mail.');
$mail->setFrom('sender@test.com', 'Some Sender');
$mail->addTo('recipient@test.com', 'Some Recipient');
$mail->setSubject('TestSubject');
$mail->send($transport);

    

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务