|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2016-04-23 12:01 UTC] 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. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 09:00:02 2025 UTC |
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)