Programmer's Reference Guide
| Controlling the MIME Boundary |
Additional Headers
Zend_Mail provides several methods to set additional Mail Headers:
-
setReplyTo($email, $name=null): sets the Reply-To: header.
-
setDate($date = null): sets the Date: header. This method uses current time stamp by default. Or You can pass time stamp, date string or Zend_Date instance to this method.
-
setMessageId($id = true): 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 createMessageId() internally.
Note: Return-Path
If you set Return-Path on your mail, see Configuring sendmail transport. Unfortunately, setReturnPath($email) method does not perform this purpose.
Furthermore, arbitrary mail headers can be set by using the addHeader() 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:
Example #1 Adding E-Mail Message Headers
- $mail = new Zend_Mail();
- $mail->addHeader('X-MailGenerator', 'MyCoolApplication');
- $mail->addHeader('X-greetingsTo', 'Mom', true); // multiple values
- $mail->addHeader('X-greetingsTo', 'Dad', true);
| Controlling the MIME Boundary |
Add A Comment
Please do not report issues via comments; use the ZF Issue Tracker.
If you have a JIRA/Crowd account, we suggest you login first before commenting.
Select a Version
Languages Available
Components
Search the Manual
Navigation
- Programmer's Reference Guide
- Programmer's Reference Guide
- Zend Framework Reference
- Zend_Mail
- Introduction
- Sending via SMTP
- Sending Multiple Mails per SMTP Connection
- Using Different Transports
- HTML E-Mail
- Attachments
- Adding Recipients
- Controlling the MIME Boundary
- Additional Headers
- Character Sets
- Encoding
- SMTP Authentication
- Securing SMTP Transport
- Reading Mail Messages

Comments