|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40952 mail: Malformed date header (H0600)
Submitted: 2007-03-29 20:14 UTC Modified: 2007-05-04 01:00 UTC
Avg. Score:4.2 ± 0.8
Reproduced:7 of 7 (100.0%)
Same Version:2 (28.6%)
Same OS:3 (42.9%)
From: sh at nnoncarey dot com Assigned:
Status: No Feedback Package: Mail related
PHP Version: 4.4.6 OS: Windows Server 2003
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: sh at nnoncarey dot com
New email:
PHP Version: OS:


 [2007-03-29 20:14 UTC] sh at nnoncarey dot com
Email sent with PHP's mail() function often (but not always) has a malformed Date: header.  Specifically, the minus sign before the UTC offset is replaced with a capital letter "H".  In my timezone (US Central Standard -6), this means "H0600" instead of "-0600".

The occurrence of this problem does not appear to be related to the recent US DST change.

Here is a date header illustrating the problem, along with the X-OriginalArrivalTime header from the same email, just for comparison:

Date: Wed, 28 Mar 2007 14:04:37 H0600
X-OriginalArrivalTime: 28 Mar 2007 19:04:36.0042 (UTC) FILETIME=[ED52E2A0:01C7716B]

But here is just one example which worked as expected.

Date: Tue, 06 Feb 2007 07:54:42 -0600
X-OriginalArrivalTime: 06 Feb 2007 13:54:30.0533 (UTC) 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-03 18:38 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

 [2007-04-05 21:37 UTC] sh at nnoncarey dot com
Smallest script to duplicate bug
ini_set('SMTP', '');

mail('', 'subject', "message\n");
 [2007-04-11 22:55 UTC] cipri at php dot ne
The same happens on PHP 5.1.2 on a Linux FC6 server. However the entire header gets malformed here:

Fri, 12 Apr 2007 00:48:19 -2200

The accurate date would be:
Thu, 12 Apr 2007 00:48:19 +0200

I've send mails manually via telnet to my mailserver without a date header thinking it might be the cause, but it adds correct mails, so the problem clearly lies within the PHP implementation of mail()
 [2007-04-12 07:33 UTC]
On Windows PHP talks SMTP to the server, so this is possible (though unlikely, otherwise it would have been noticed years ago).
On Linux PHP just calls sendmail binary and passes all the data to it, so look for a problem there, definitely not PHP problem.

 [2007-04-26 09:11 UTC]
Please try using this CVS snapshot:
For Windows:

 [2007-05-04 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-10-02 18:19 UTC] davinderkumar at gmail dot com
I am experiencing the same problem in PHP Version 5.2.0. This happens 
when emails are sent using PHP script running through php.exe inside 
Windows Schedular. Emails received are stale due to incorrect time-zone 
stamp as following:

Date: Mon, 28 Sep 2009 04:52:12 H0700

I am using Windows Server 2003 (Enterprise Edition).

Same script works fine if executed through the browser.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Jun 14 10:01:23 2021 UTC