Bug #72086 [NEW]: Regression handling Bcc and Cc headers

From: Date: Sat, 23 Apr 2016 12:01:30 +0000
Subject: Bug #72086 [NEW]: Regression handling Bcc and Cc headers
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200713@lists.php.net to get a copy of this message
From:             bill dot seddon at lyquidity dot com
Operating system: Windows x86 NTS
PHP version:      7.0.5
Package:          Mail related
Bug Type:         Bug
Bug description:Regression handling Bcc and Cc headers

Description:
------------
The mail function in 7.0.x does not work if the headers parameter
contains an unnamed Bcc or Cc address or if it is not the last header. 
In the error cases the function will return a 550 status code however
the function does not contact the SMTP server at this time.

The function will re  The function will successfully send an email that
includes this header:

Bcc: Me <me@mydomain.com>

But will fail and return false if the header is:

Bcc: me@mydomain.com

Both work when used with version 5.3 (I have not checked later
versions).

The unnamed address (me@domain.com) will work if the Bcc header is the
last header or if the From header is the last header and Bcc is the
penultimate header.  There are other weird combinations that work/do not
work.  In the test script I've provided an illustration.

Clearly the success or failure of the function should not depend upon
the relative position of a header on the set of headers.



Test script:
---------------
This a basic function call.  Alternative headers are provided after.

echo mail( "recipient@mydomain.com", "Subject", "Some message",
implode(
"\n", $headers ), "" ) ? "Sent" : "Not sent";

// This header works because the Bcc is at the end
$headers = array(
	"Date: Sat, 23 Apr 2016 11:25:00 +0000",
	"To: recipient@mydomain.com",
	"From: Some sender <info@mydomain.com>",
	"Bcc: me@lyquidity.com",
);

// This header fails because the Bcc is not at the end
$headers = array(
	"To: recipient@mydomain.com",
	"From: Some sender <info@mydomain.com>",
	"Bcc: me@lyquidity.com",
	"Date: Sat, 23 Apr 2016 11:25:00 +0000",
);

// This header works because the Bcc is the penultimate
$headers = array(
	"Date: Sat, 23 Apr 2016 11:25:00 +0000",
	"To: recipient@mydomain.com",
	"Bcc: me@mydomain.com",
	"From: Some sender <info@mydomain.com>",
);


Expected result:
----------------
The mail to be sent providing the email addresses themselves are valid.


-- 
Edit bug report at https://bugs.php.net/bug.php?id=72086&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=72086&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=72086&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=72086&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=72086&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=72086&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=72086&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=72086&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=72086&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=72086&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=72086&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=72086&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=72086&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=72086&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72086&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=72086&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=72086&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=72086&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72086&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=72086&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=72086&r=mysqlcfg



Thread (4 messages)

« previous php.bugs (#200713) next »