1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
<?xml version="1.0" encoding="UTF-8"?>
<!-- Reviewed: no -->
<sect1 id="zend.mail.smtp-secure">
<title>Securing SMTP Transport</title>
<para>
<classname>Zend_Mail</classname> also supports the use of either TLS or
<acronym>SSL</acronym> to secure a SMTP connection. This can be enabled be passing the
'ssl' parameter to the configuration array in the
<classname>Zend_Mail_Transport_Smtp</classname> 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
<acronym>SSL</acronym>.
</para>
<example id="zend.mail.smtp-secure.example-1">
<title>Enabling a secure connection within Zend_Mail_Transport_Smtp</title>
<programlisting language="php"><![CDATA[
$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);
]]></programlisting>
</example>
</sect1>
<!--
vim:se ts=4 sw=4 et:
-->
|