Bug #71726 [NoF->Fbk]: Headers are transformed wrongly

From: Date: Mon, 08 May 2017 17:42:54 +0000
Subject: Bug #71726 [NoF->Fbk]: Headers are transformed wrongly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209006@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71726&edit=1 ID: 71726 Updated by: requinix@php.net Reported by: bugs dot php at myrosoft dot com Summary: Headers are transformed wrongly -Status: No Feedback +Status: Feedback Type: Bug Package: Mail related Operating System: Windows 7 PHP Version: 7.0.4 Block user comment: N Private report: N New Comment: I still haven't been able to reproduce either. Using PHPMailer 5.2.23. Let's try PHPMailer without mail(). Can you do the same email but using $mailer->isSMTP(); $mailer->Host = "localhost"; $mailer->Port = 25; $mailer->SMTPDebug = 3; Assuming that works correctly, try the reverse of mail() without PHPMailer: $headers = implode("\r\n", [ "From: SystemMailer <mailer@example.com>", "Cc: CC Account <test2@example.com>", "X-Foo: foo", "Bcc: BCC Account <test3@example.com>", "X-Bar: bar", "Reply-To: ReplyTo Account <test4@example.com>" ]); mail("test@example.com", "PHP 7.1.1 email Test", "Sample email test.", $headers); Previous Comments: ------------------------------------------------------------------------ [2017-05-08 16:49:16] jonathan dot tyler at loadaccess dot net Also, I should add, the To: column in smtp4dev shows the following: With BCC - To: test@example.com, test2@example.com, test3@example.com Without BCC - To: test@example.com, test2@example.com So it does appear to be picking up the BCC email address, but it's messing up the ReplyTo in the process. ------------------------------------------------------------------------ [2017-05-08 15:23:50] jonathan dot tyler at loadaccess dot net Sorry this took so long to get back to, but the issue has not been resolved.... Example mailer code: ---------- /* * Use PHPMailer with php.ini "mail function" settings. * I'm sure just using the standard PHPMailer class without Joomla will produce the same. */ $mailer = JFactory::getMailer(); $mailer->LE = "\r\n"; // Line End CRLF $mailer->isHTML(true); $mailer->setFrom('mailer@example.com','SystemMailer'); $mailer->addRecipient('test@example.com','To Account'); $mailer->addCC('test2@example.com','CC Account'); $mailer->addBCC('test3@example.com','BCC Account'); $mailer->addReplyTo('test4@example.com','ReplyTo Account'); $mailer->setSubject('PHP 7.1.1 email Test'); $mailer->setBody('Sample email test.'); try { $mailer->send(); } catch (phpmailerException $e) { echo $e->errorMessage(); } catch (Exception $e) { echo $e->getMessage(); } ---------- Output from Smtp4Dev (with BCC): ---------- Subject: PHP 7.1.1 email Test To: To Account <test@example.com> X-PHP-Originating-Script: 0:class.phpmailer.php Date: Mon, 8 May 2017 11:14:53 -0400 From: SystemMailer <mailer@example.com> Cc: CC Account <test2@example.com> BReply-To: ReplyTo Account <test4@example.com> Message-ID: <e426383c205069ba6724f3ee692142fb@localhost> MIME-Version: 1.0 Content-Type: text/html; charset=utf-8 Sample email test. ---------- Output from Smtp4Dev (without BCC): ---------- Subject: PHP 7.1.1 email Test To: To Account <test@example.com> X-PHP-Originating-Script: 0:class.phpmailer.php Date: Mon, 8 May 2017 11:18:54 -0400 From: SystemMailer <mailer@example.com> Cc: CC Account <test2@example.com> Reply-To: ReplyTo Account <test4@example.com> Message-ID: <820a74989fdb906369fd2be445a0d06c@localhost> MIME-Version: 1.0 Content-Type: text/html; charset=utf-8 Sample email test. ---------- Switching around the order of the PHPMailer functions doesn't have an effect. If I remove BCC I get the replyTo correctly, but I can't tell what happens with the BCC if I remove the replyTo as it's not shown in smtp4dev. ------------------------------------------------------------------------ [2017-05-07 04:22:34] php-bugs at lists dot php dot net 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. ------------------------------------------------------------------------ [2017-04-28 17:45:06] jonathan dot tyler at loadaccess dot net Thanks for the detailed next steps :) I'll try and get some testing done using those methods over the weekend. ------------------------------------------------------------------------ [2017-04-28 17:13:19] requinix@php.net I can reproduce the *results* easily enough, using something like BBcc: user@example.com which I've made bug #74510 for, but I can't reproduce yet with code that isn't clearly wrong. @jonathan, can you come up with a small-ish unredacted script (with or without using JMail+PHPMailer) that mirrors your code and gives the BReply-To outcome? You can use something like smtp4dev or Papercut to set up a local test SMTP server that logs messages instead of sending them, which would allow you to use fake data for everything. Additionally, testing your current code with smtp4dev/Papercut could at least help establish whether the problem is with PHP. Meanwhile I'm still looking... ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=71726 -- Edit this bug report at https://bugs.php.net/bug.php?id=71726&edit=1

« previous php.bugs (#209006) next »