Zend_Mail-SmtpSecure.xml 1.3 KB

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