Bug #71726 [Com]: Headers are transformed wrongly

From: Date: Mon, 08 May 2017 19:57:52 +0000
Subject: Bug #71726 [Com]: Headers are transformed wrongly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209010@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
 Comment by:         jonathan dot tyler at loadaccess dot net
 Reported by:        bugs dot php at myrosoft dot com
 Summary:            Headers are transformed wrongly
 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:

That worked!
I downloaded 7.1.4 and overwrote the 7.1.1 files that IIS (Web Platform) installed (7.1.4 is not
available through Web Platform Installer yet apparently).

Subject: PHP 7.1.4 email Test
To: To Name <test@example.com>
X-PHP-Originating-Script: 0:class.phpmailer.php
Date: Mon, 8 May 2017 15:55:22 -0400
From: From Name <me@example.com>
Cc: CC Name <test2@example.com>
Reply-To: ReplyTo Name <no-reply@example>
Message-ID: <ae34994b9985737c93c1533a28620558@localhost>
MIME-Version: 1.0
Content-Type: text/html; charset=utf-8

Sample email test.

Thanks for helping narrow down the culprit ;) I just have to do the same thing I our Servers now.


Previous Comments:
------------------------------------------------------------------------
[2017-05-08 19:42:03] requinix@php.net

Reproduced! Script is that implode+mail stuff from earlier and it only happens with php-cgi.exe.
However it seems to be fixed already in 7.0.18 and 7.1.4. Can you confirm that?

------------------------------------------------------------------------
[2017-05-08 18:41:49] jonathan dot tyler at loadaccess dot net

I just realized I should include my laptop system setup.

Windows 10 Pro
IIS Express
PHP 7.1.1 (x86_64)

Joomla 3.7.0
PHPMailer 5.2.22

I'll look and see if there's a new version of PHPMailer. Looks like I may have to manually
update Joomla.

------------------------------------------------------------------------
[2017-05-08 18:37:24] jonathan dot tyler at loadaccess dot net

When using the isSMTP() flag I had to use our internal mail server, smtp4dev keeps crashing with
some SSL socket connection error.
That said, it worked and the headers showed the correct ReplyTo.
I setup myself as the BCC and received the email.

-----------
Date: Mon, 8 May 2017 14:33:20 -0400
To: To Account <test@example.com>
From: Jonathan Tyler <jonathan.tyler@loadaccess.net>
Cc: CC Account <test2@example.com>
Reply-To: ReplyTo Account <no-reply@loadaccess.net>
Subject: PHP 7.1.1 email Test
Message-ID: <a7f4ba9cb99fd0981f0301f4167e6cbb@localhost>
MIME-Version: 1.0
Content-Type: text/html; charset=utf-8

Sample email test.
-------------

For your second suggested test (I switched back to localhost):

Date: Mon, 08 May 2017 14:21:09 -0400
Subject: PHP 7.1.1 email Test
To: test@example.com
X-PHP-Originating-Script: 0:mailtest.php
From: SystemMailer <mailer@example.com>
Cc: CC Account <test2@example.com>
X-Foo: foo
BX-Bar: bar
Reply-To: ReplyTo Account <test4@example.com>

Sample email test.
-----------------

It doesn't appear to have worked, as noted by the BX-Bar.

------------------------------------------------------------------------
[2017-05-08 17:42:52] requinix@php.net

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);

------------------------------------------------------------------------
[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.

------------------------------------------------------------------------


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


Thread (17 messages)

« previous php.bugs (#209010) next »