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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
<?xml version="1.0" encoding="UTF-8"?>
<!-- Reviewed: no -->
<sect1 id="zend.mail.additional-headers">
<title>Additional Headers</title>
<para>
<classname>Zend_Mail</classname> provides several methods to set additional Mail Headers:
<itemizedlist>
<listitem>
<para>
<methodname>setReplyTo($email, $name=null)</methodname>: sets the Reply-To:
header.
</para>
</listitem>
<listitem>
<para>
<methodname>setDate($date = null)</methodname>: sets the Date: header.
This method uses current time stamp by default. Or You can pass time stamp,
date string or <classname>Zend_Date</classname> instance to this method.
</para>
</listitem>
<listitem>
<para>
<methodname>setMessageId($id = true)</methodname>: sets the Message-Id: header.
This method can generate message ID automatically by default. Or You can pass
your message ID string to this method.
This method call <methodname>createMessageId()</methodname> internally.
</para>
</listitem>
</itemizedlist>
</para>
<note>
<title>Return-Path</title>
<para>
If you set Return-Path on your mail, see <link linkend="zend.mail.introduction.sendmail"
>Configuring sendmail transport</link>.
Unfortunately, <methodname>setReturnPath($email)</methodname> method does not perform
this purpose.
</para>
</note>
<para>
Furthermore, arbitrary mail headers can be set by using the
<methodname>addHeader()</methodname> method. It requires two parameters containing the name
and the value of the header field. A third optional parameter determines if the header
should have only one or multiple values:
</para>
<example id="zend.mail.additional-headers.example-1">
<title>Adding E-Mail Message Headers</title>
<programlisting language="php"><![CDATA[
$mail = new Zend_Mail();
$mail->addHeader('X-MailGenerator', 'MyCoolApplication');
$mail->addHeader('X-greetingsTo', 'Mom', true); // multiple values
$mail->addHeader('X-greetingsTo', 'Dad', true);
]]></programlisting>
</example>
</sect1>
<!--
vim:se ts=4 sw=4 et:
-->
|