php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12680 mail() is sent with incorrect timezone
Submitted: 2001-08-09 17:23 UTC Modified: 2001-11-30 04:29 UTC
From: justin dot white at wcom dot com Assigned:
Status: Closed Package: Mail related
PHP Version: 4.0.6 OS: Windows NT 4.0 SP6
Private report: No CVE-ID: None
 [2001-08-09 17:23 UTC] justin dot white at wcom dot com
I think I have a bug with the Win32 version of php.exe (perhaps the ISAPI version also?) where the SENT time on every email that goes out shows up as incorrect.  I've tried it several times, even with multiple versions (also tested 4.0.4pl1 and 4.0.5).  No matter what I try, any email sent by php's mail() function is received with the wrong timezone (so mail time appears correct, but received from earlier time because of zone).

I am not using any addons for PHP.  I have IIS 4.0 using PHP in CGI mode, with the SMTP service loaded locally.  I am also running mySQL 3.23.37.

I can successfully telnet to port 25 on that server and send myself an email using SMTP commands.  I'll post my mail script shortly.

Any thoughts?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-09 17:27 UTC] justin dot white at wcom dot com
Here's the portion of the script that governs mail:

if (isset($mail_from) || isset($mail_cc)) {
  $mail_headers = "From: $mail_from\r\nReply-to: $mail_from\r\n";

  if (isset($mail_cc) && ($mail_cc != "")) {
    $mail_headers = $mail_headers . "Cc: $mail_cc\r\n";
  }
}
else {
  $mail_headers = "";
}

if (isset($mail_to) && isset($mail_subject) && isset($mail_body) && isset($mail_headers) && ($submit == "Submit")) {

  mail($mail_to, $mail_subject, $mail_body, $mail_headers);


 [2001-08-09 17:32 UTC] justin dot white at wcom dot com
Here's headers from a bad email:

Return-Path: <XXX@wcom.com>
Received: from XXX.wcomnet.com ([XXX.XXX.XXX.XXX]) by
          XXX.XXX.XXX.XXX (Netscape Messaging Server 4.15) with
ESMTP
          id GHT2IQ00.KNI; Thu, 9 Aug 2001 14:49:38 +0000 
Return-path: XXX@wcom.com
Received: from CONVERSION-DAEMON by dgismtp03.wcomnet.com (PMDF V5.2-33
#42262)
 id <0GHT001012IP4Z@XXX.wcomnet.com>; Thu,
 9 Aug 2001 14:49:37 +0000 (GMT)
Received: from XXX.wcomnet.com by XXX.wcomnet.com
 (PMDF V5.2-33 #42262) with SMTP id
<0GHT001012IC2M@XXX.wcomnet.com>;
 Thu, 09 Aug 2001 14:49:36 +0000 (GMT)
Received: from XXX.wcomnet.com ([XXX.XXX.XXX.XXX])
 by XXX.wcomnet.com (PMDF V5.2-33 #42262)
 with ESMTP id <0GHT0002V2I2SM@XXX.wcomnet.com>; Thu,
 09 Aug 2001 14:49:14 +0000 (GMT)
Received: from XXX.XXX.XXX.XXX by XXX.wcomnet.com  with Microsoft
 SMTPSVC(5.5.1774.114.11); Thu, 09 Aug 2001 09:41:11 -0500
Date: Thu, 09 Aug 2001 09:41:11 +0600
From: XXX@wcom.com
Subject: XXX
X-Sender: <XXX@wcom.com>
To: XXX@wcom.com
Cc: XXX@wcom.com
Reply-to: XXX@wcom.com
Message-id: <0004b1141140981ESERVER@XXX.wcomnet.com>
 [2001-08-09 17:35 UTC] justin dot white at wcom dot com
Here's the headers from the email I sent via telnet:

Return-Path: <justin.white@wcom.com>
Received: from XXX.wcomnet.com ([XXX.XXX.XXX.XXX]) by
          XXX.wcomnet.com (Netscape Messaging Server 4.15) with ESMTP
          id GHTIG600.IEW for <justin.white@wcom.com>; Thu, 9 Aug 2001
          20:33:42 +0000 
Return-path: justin.white@wcom.com
Received: from CONVERSION-DAEMON by XXX.wcomnet.com (PMDF V5.2-33 #42262)
 id <0GHT00101IG3ZS@XXX.wcomnet.com> for justin.white@wcom.com; Thu,
 9 Aug 2001 20:33:42 +0000 (GMT)
Received: from XXX.wcomnet.com by XXX.wcomnet.com
 (PMDF V5.2-33 #42262) with SMTP id <0GHT00101IFFSV@XXX.wcomnet.com> for
 justin.white@wcom.com; Thu, 09 Aug 2001 20:33:39 +0000 (GMT)
Received: from XXX.wcomnet.com ([XXX.XXX.XXX.XXX])
 by XXX.wcomnet.com (PMDF V5.2-33 #42262)
 with ESMTP id <0GHT00KPOIEXY1@XXX.wcomnet.com> for
 justin.white@wcom.com; Thu, 09 Aug 2001 20:32:57 +0000 (GMT)
Received: from XXX.XXX.XXX.XXX by XXX.wcomnet.com  with Microsoft
 SMTPSVC(5.5.1774.114.11); Thu, 09 Aug 2001 15:24:25 -0500
Date: Thu, 09 Aug 2001 15:24:52 -0500
From: justin.white@wcom.com
Bcc: 
Message-id: <0022f2524200981ESERVER@XXX.wcomnet.com>

This is a test message 
 [2001-08-10 09:45 UTC] alindeman@php.net
Is the timezone on your mailserver the same as the zone on your
computer???
 [2001-08-10 10:26 UTC] justin dot white at wcom dot com
Yes, the timezone and time have been verified on the server and on my workstation.  Both are set to CDT (-0500).

The test email reflected the correct timezone, but the PHP-created one did not.
 [2001-08-10 10:32 UTC] alindeman@php.net
Does this happen with just PHP, or with any mail program
that you use?
 [2001-08-10 10:36 UTC] justin dot white at wcom dot com
This happens with just PHP.  As I said, I can directly connect to port 25 and manually enter SMTP commands to send an email (see second mail header sample).  The timezone correctly shows -0500 for CDT.  The time listed in the PHP-created email shows the time correctly, but doesn't show the timezone correctly (see first mail header sample).
 [2001-08-10 10:45 UTC] alindeman@php.net
something similar has been reported as a bug in 4.0 and was
assigned to hholzgra.  I don't know if it has been fixed.

Suspended until I can contact him and see if he's fixed it.

If anybody else knows anything about this, second opinion is
welcome.
 [2001-08-10 11:01 UTC] justin dot white at wcom dot com
This happens with just PHP.  As I said, I can directly connect to port 25 and manually enter SMTP commands to send an email (see second mail header sample).  The timezone correctly shows -0500 for CDT.  The time listed in the PHP-created email shows the time correctly, but doesn't show the timezone correctly (see first mail header sample).
 [2001-11-30 04:29 UTC] derick@php.net
Fixed in CVS
 [2002-01-30 21:05 UTC] chank01 at yahoo dot com
Where can I find out when this bug fix is going to be released? Also where can I find out which bug fixes where included in previous release?

TIA

chank
 [2002-02-08 06:05 UTC] daniel at nospam dot se
I'm running 4.1.1 on a W2k/IIS5, the bug is not fixed, in which relase was the bug fix included?

- daniel
 [2002-02-18 15:52 UTC] daniel at nospam dot se
I found a solution to this problem!

I'm running W2k with IIS5 and PHP 4.1.1.

The mail function has the following parameters,
mail($mail_to, $mail_subject, $mail_body, $mail_headers);

Just add date("r") to the header like:
$mail_headers .= "\nDate: " . date("r");

And the email header will have the correct date!

- daniel
 [2004-05-12 21:01 UTC] flashx at madskillz dot se
Now it's 2004 and we are running Win2003/IIS6 with PHP 4.3.6 and still having this problem...
 [2004-06-09 17:07 UTC] nefarioussquirrel at yahoo dot com
I can also confirm that the bug exists in php 4.3.6 on xp/apache.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC