Bug #72086 [Fbk->NoF]: Regression handling Bcc and Cc headers

From: Date: Sun, 24 Oct 2021 04:22:13 +0000
Subject: Bug #72086 [Fbk->NoF]: Regression handling Bcc and Cc headers
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237347@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72086&edit=1

 ID:               72086
 Updated by:       php-bugs@lists.php.net
 Reported by:      bill dot seddon at lyquidity dot com
 Summary:          Regression handling Bcc and Cc headers
-Status:           Feedback
+Status:           No Feedback
 Type:             Bug
 Package:          Mail related
 Operating System: Windows x86 NTS
 PHP Version:      7.0.5
 Assigned To:      cmb
 Private report:   N

 New Comment:

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.


Previous Comments:
------------------------------------------------------------------------
[2021-10-11 17:09:57] cmb@php.net

It looks like this has been fixed in the meantime, or do you still
experience this with any of the actively supported PHP
versions[1].

[1] <https://www.php.net/supported-versions.php>

------------------------------------------------------------------------
[2016-05-17 17:27:34] jpmoularde at free dot fr

Same issue with PHP Version 5.5.9-1ubuntu4.14 

Additional information:
$headers = array('From: Some user<some.user@site.net>',
                 'Content-type: text/plain; charset=iso-8859-1;',
		 'Content-Transfer-Encoding: 8bit;',
                 'Bcc: <some.user@site.net>');
works well whereas
1) $headers = array('From: Some user<some.user@site.net>',
                    'Bcc: <some.user@site.net>',
                    'Content-type: text/plain; charset=iso-8859-1;',
		    'Content-Transfer-Encoding: 8bit;',
                    'Bcc: <some.user@site.net>');
results in the 'Content-type:' parameter being deeply flawed in the resulting message
2) 'Cc: Some user<some.user@site.net>' or 'Bcc: Some
user<some.user@site.net>'
result in the mail() function returning "false", i.e. the only valid syntax is 
'Cc: some.user@site.net' or 'Bcc: some.user@site.net'

These issues are regressions vis a vis le previous version I used for years (PHP 5.2.xx)

------------------------------------------------------------------------
[2016-04-23 12:01:26] bill dot seddon at lyquidity dot com

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 this bug report at https://bugs.php.net/bug.php?id=72086&edit=1


Thread (4 messages)

« previous php.bugs (#237347) next »