1 <?xml version="1.0" encoding="UTF-8"?>
3 <sect1 id="zend.mail.additional-headers">
4 <title>Additional Headers</title>
7 <classname>Zend_Mail</classname> provides several methods to set additional Mail Headers:
12 <methodname>setReplyTo($email, $name=null)</methodname>: sets the Reply-To:
19 <methodname>setDate($date = null)</methodname>: sets the Date: header.
20 This method uses current time stamp by default. Or You can pass time stamp,
21 date string or <classname>Zend_Date</classname> instance to this method.
27 <methodname>setMessageId($id = true)</methodname>: sets the Message-Id: header.
28 This method can generate message ID automatically by default. Or You can pass
29 your message ID string to this method.
30 This method call <methodname>createMessageId()</methodname> internally.
37 <title>Return-Path</title>
40 If you set Return-Path on your mail, see <link linkend="zend.mail.introduction.sendmail"
41 >Configuring sendmail transport</link>.
42 Unfortunately, <methodname>setReturnPath($email)</methodname> method does not perform
48 Furthermore, arbitrary mail headers can be set by using the
49 <methodname>addHeader()</methodname> method. It requires two parameters containing the name
50 and the value of the header field. A third optional parameter determines if the header
51 should have only one or multiple values:
54 <example id="zend.mail.additional-headers.example-1">
55 <title>Adding E-Mail Message Headers</title>
57 <programlisting language="php"><![CDATA[
58 $mail = new Zend_Mail();
59 $mail->addHeader('X-MailGenerator', 'MyCoolApplication');
60 $mail->addHeader('X-greetingsTo', 'Mom', true); // multiple values
61 $mail->addHeader('X-greetingsTo', 'Dad', true);