php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29334 mail() provides incorrect message time header
Submitted: 2004-07-22 18:25 UTC Modified: 2005-08-08 00:06 UTC
Votes:18
Avg. Score:4.2 ± 0.8
Reproduced:17 of 17 (100.0%)
Same Version:5 (29.4%)
Same OS:13 (76.5%)
From: php dot time dot bug at aaronoff dot com Assigned:
Status: Closed Package: Mail related
PHP Version: 5CVS, 4CVS (2005-02-05) OS: win32
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: php dot time dot bug at aaronoff dot com
New email:
PHP Version: OS:

 

 [2004-07-22 18:25 UTC] php dot time dot bug at aaronoff dot com
Description:
------------
I'm using the mail() function to send a message from my home SMTP server to my domain's SMTP server via my installation of MS IIS 5.0 SMTP under W2K SP4.

The time zone for my home PC is GMT +0200 in summer (with DST), +0100 in winter (w/o DST). In Windows Control Panel, Date/Time Properties, Time Zone tab, the time zone shows as +0100 and "Automatically adjust time for daylight saving changes" is checked. DST, then, increases the offset on my PC from +0100 to +0200.

The e-mail message retrieved by my e-mail client from my domain's SMTP server has a message header Date field set to the right hour but at GMT offset +0100 -- this is the wrong time. Since my e-mail client displays messages with time sent corrected to my local time, it adds an hour and the message shows with a time one hour *ahead* of the time it was actually sent.

Ex: message sent by mail() at 16:10 +0200
    Date field in message header on home SMTP server shows 16:10 +0100 <-- this is the wrong time!
    message sent by home SMTP server at 16:10 +0200
    message received by e-mail client from domain at 16:11 +0200
    e-mail client shows sent message time of 17:10 +0200

If a text message with just From:, To: and Subject: headers is dropped into the home SMTP "Queue" folder, the home SMTP server adds the local time with the correct GMT offset to the message header Date field. This shows that the problem is not coming from the home SMTP server itself, but from the program that's providing it with date information.

IMHO, mail() is not using the correcting the GMT offset for DST.

I've been unable to find any mention of an INI-file parameter for this, Googling results were meager, and I found no open bugs.

HTH.

regards, Andy

Reproduce code:
---------------
mail($dest,$subject,$body)

Expected result:
----------------
The Date: field in the message's header should show the correct hour and GMT offset.

Actual result:
--------------
The Date: field in the message's header shows the correct hour but the wrong GMT offset -- it's not corrected for DST.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-06 16:20 UTC] mike-php at emerge2 dot com
Interestingly, a call to date( 'r' ) returns the expected string, and even pays attention to the setting in the Date Control Panel. Perhaps mail() could simply call PHP's own date( 'r' ) function to create the Date Header?
 [2005-04-21 23:14 UTC] jbrady at sbccd dot cc dot ca dot us
We have 2 windows 2003 IIS6 servers with php 5.0.2 (build date Sep 24 2004 01:24:24) and php 5.0.3 (build date Dec 15 2004 08:06:41). We have this same problem.
 [2005-08-08 00:06 UTC] sniper@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Fixed in PHP 5. Make sure you set "date.timezone" properly in your php.ini or by using date_default_timezone_set() function.
The mail() function under win32 now uses same function as date("r"); does. 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 12:01:29 2024 UTC