Zend_Mail-AdditionalHeaders.xml 2.4 KB

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