Zend_Mail-SmtpSecure.xml 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.mail.smtp-secure">
  4. <title>Securing SMTP Transport</title>
  5. <para><classname>Zend_Mail</classname> also supports the use of either TLS or SSL to
  6. secure a SMTP connection. This can be enabled be passing the 'ssl' parameter
  7. to the configuration array in the <classname>Zend_Mail_Transport_Smtp</classname>
  8. constructor with a value of either 'ssl' or 'tls'. A port can optionally be
  9. supplied, otherwise it defaults to 25 for TLS or 465 for SSL.</para>
  10. <example id="zend.mail.smtp-secure.example-1">
  11. <title>Enabling a secure connection within Zend_Mail_Transport_Smtp</title>
  12. <programlisting language="php"><![CDATA[
  13. $config = array('ssl' => 'tls',
  14. 'port' => 25); // Optional port number supplied
  15. $transport = new Zend_Mail_Transport_Smtp('mail.server.com', $config);
  16. $mail = new Zend_Mail();
  17. $mail->setBodyText('This is the text of the mail.');
  18. $mail->setFrom('sender@test.com', 'Some Sender');
  19. $mail->addTo('recipient@test.com', 'Some Recipient');
  20. $mail->setSubject('TestSubject');
  21. $mail->send($transport);
  22. ]]></programlisting>
  23. </example>
  24. </sect1>
  25. <!--
  26. vim:se ts=4 sw=4 et:
  27. -->