ZF-2110: No Date header is added to mail messages before sending

Issue Type: Bug Created: 2007-10-29T10:08:55.000+0000 Last Updated: 2008-03-21T16:25:28.000+0000 Status: Resolved Fix version(s): - 1.5.0 (17/Mar/08)

Reporter: Nico Edtinger (nico) Assignee: Nico Edtinger (nico) Tags: - Zend_Mail

Related issues: Attachments: - Mail.php.patch


If a date header is not set while assembling the message it needs to be added before sending.

From: KyleMac Subject: Re: [fw-general] Zend_Mail

I was just looking into this missing date header thing since it caused a few emails to bounce. From what I can tell, the MTA is under no obligation to add the date header and in Exim it's considered a "fixup" (or rather, not doing it is called suppressing fixups). Short story; if your MTA adds it then it's being kind, if not then it's your fault for not doing it yourself.

Considering the date header is meant to be a requirement, I think that maybe it deserves at least a mention in the ZF manual, maybe it's own addDate() method and probably to be added automatically by Zend_Mail.

Matthew Weier O'Phinney-2 wrote:

On 7/6/06, Brent Robinson wrote:

I am having a problem with Zend_Mail that my mail is not passing a date header. I am getting a 01/01/1970 date in thunderbird and a unknown date in Webmail.

I am using SMTP and am developing on a Windows Platform with Apache 2 and PHP5.

Is there something that I am overlooking or am not setting. I have looked and googled the whole afternoon but cannot find anything.

Date headers are usually set by the mail transport; if you're not seeing one, then your transport isn't putting it in (which is bad behaviour on the part of the transport).

Two options: investigate your mail transport and see why it's not setting the date header, or set it manually using Zend_Mail's addHeader() method:

$mail->addHeader('Date', date('r'));

What are you using for mail delivery, by the way? You mention SMTP, but you don't specify what kind of SMTP server you're using. Others may be able to point out additional remedies based on that information.

</mailing list thread>

From RFC 2822: "[The origination date specifies] the time at which the human or other creator of the message has put the message into its final form, ready for transport."


Posted by Jordan Ryan Moore (jordanryanmoore) on 2007-12-13T18:29:11.000+0000

Attached a patch that adds new setDate()/getDate() methods. If a date is not set before send()ing, it's automatically set.

Posted by Wil Sinclair (wil) on 2008-01-15T17:31:53.000+0000

Nico, will you have time to get to this by the PR code freeze (1/22)?

Posted by Nico Edtinger (nico) on 2008-01-21T13:41:50.000+0000

Thanks Jordan for the patch. It's added to trunk, with some modifications and should be fully tested (don't have xdebug installed here).

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.