Zend_Mail-AdditionalHeaders.xml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.mail.additional-headers">
  4. <title>Additional Headers</title>
  5. <para>
  6. <classname>Zend_Mail</classname> provides several methods to set additional Mail Headers:
  7. <itemizedlist>
  8. <listitem>
  9. <para>
  10. <methodname>setReplyTo($email, $name=null)</methodname>: sets the Reply-To:
  11. header.
  12. </para>
  13. </listitem>
  14. <listitem>
  15. <para>
  16. <methodname>setDate($date = null)</methodname>: sets the Date: header.
  17. This method uses current time stamp by default. Or You can pass time stamp,
  18. date string or <classname>Zend_Date</classname> instance to this method.
  19. </para>
  20. </listitem>
  21. <listitem>
  22. <para>
  23. <methodname>setMessageId($id = true)</methodname>: sets the Message-Id: header.
  24. This method can generate message ID automatically by default. Or You can pass
  25. your message ID string to this method.
  26. This method call <methodname>createMessageId()</methodname> internally.
  27. </para>
  28. </listitem>
  29. </itemizedlist>
  30. </para>
  31. <note>
  32. <title>Return-Path</title>
  33. <para>
  34. If you set Return-Path on your mail, see <link linkend="zend.mail.introduction.sendmail"
  35. >Configuring sendmail transport</link>.
  36. Unfortunately, <methodname>setReturnPath($email)</methodname> method does not perform
  37. this purpose.
  38. </para>
  39. </note>
  40. <para>
  41. Furthermore, arbitrary mail headers can be set by using the
  42. <methodname>addHeader()</methodname> method. It requires two parameters containing the name
  43. and the value of the header field. A third optional parameter determines if the header
  44. should have only one or multiple values:
  45. </para>
  46. <example id="zend.mail.additional-headers.example-1">
  47. <title>Adding E-Mail Message Headers</title>
  48. <programlisting language="php"><![CDATA[
  49. $mail = new Zend_Mail();
  50. $mail->addHeader('X-MailGenerator', 'MyCoolApplication');
  51. $mail->addHeader('X-greetingsTo', 'Mom', true); // multiple values
  52. $mail->addHeader('X-greetingsTo', 'Dad', true);
  53. ]]></programlisting>
  54. </example>
  55. </sect1>
  56. <!--
  57. vim:se ts=4 sw=4 et:
  58. -->