Bug #72086 [Opn->Fbk]: Regression handling Bcc and Cc headers
Edit report at https://bugs.php.net/bug.php?id=72086&edit=1
ID: 72086
Updated by: cmb@php.net
Reported by: bill dot seddon at lyquidity dot com
Summary: Regression handling Bcc and Cc headers
-Status: Open
+Status: Feedback
Type: Bug
Package: Mail related
Operating System: Windows x86 NTS
PHP Version: 7.0.5
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
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>
Previous Comments:
------------------------------------------------------------------------
[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)