ID: 29334 Comment by: mike-php at emerge2 dot com Reported By: php dot time dot bug at aaronoff dot com Status: Open Bug Type: Mail related Operating System: win32 PHP Version: 4CVS, 5CVS (2005-02-05) New Comment:
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? Previous Comments: ------------------------------------------------------------------------ [2004-07-22 18:25:19] 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. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29334&edit=1