From: brian at macserve dot net
Operating system: OS X
PHP version: 4.4.1
PHP Bug Type: Mail related
Bug description: Date Header produces non-RFC date
Description:
------------
The Date header that is generated in the mail() command is not RFC
compliant in that it generates 2 spaces right before the day of the month,
when there should only be one.
This trips spam filters that are looking for sloppy programming by
spammers.
Interstingly, date('r') produces a correctly spaced date:
Thu, 05 Jan 2006 08:51:13 -0600
Probably because the day of month is padded.
line 716 from 4.4.1's sendmail.c:
sprintf(header_buffer, "Date: %s, %02d %s %04d %02d:%02d:%02d
%s%02d%02d\r\n",
Looks like this was fixed in the 5.x branch by changing this to
effectively use: date('r') in response to bug # 29334
line 706:
char *dt = php_format_date("r", 1, tNow, 1 TSRMLS_CC);
sprintf(header_buffer, "Date: %s\r\n", dt);
Reproduce code:
---------------
$toAddress = '[EMAIL PROTECTED]';
$fromAddress = '[EMAIL PROTECTED]';
$extraParams = '-f'.$fromAddress;
$subj = 'Test Date Hdr';
$emailMsg = 'Test Message';
echo mail($toAddress, $subj, $emailMsg, '', $extraParams);
Expected result:
----------------
Date: Thu, 5 Jan 2006 08:51:03 -0600 (CST)
Actual result:
--------------
Date: Thu, 5 Jan 2006 08:51:03 -0600 (CST)
--
Edit bug report at http://bugs.php.net/?id=35906&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=35906&r=trysnapshot44
Try a CVS snapshot (PHP 5.1):
http://bugs.php.net/fix.php?id=35906&r=trysnapshot51
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=35906&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=35906&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=35906&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=35906&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=35906&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=35906&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35906&r=support
Expected behavior: http://bugs.php.net/fix.php?id=35906&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=35906&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=35906&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=35906&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35906&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=35906&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=35906&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35906&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=35906&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=35906&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=35906&r=mysqlcfg