Bug #81158 [Opn]: Mails sent by mail function broken since PHP 8.0
Edit report at https://bugs.php.net/bug.php?id=81158&edit=1
ID: 81158
Updated by: tiffany@php.net
Reported by: php at shyim dot de
Summary: Mails sent by mail function broken since PHP 8.0
Status: Open
Type: Bug
Package: Mail related
Operating System: Debian 10 (Docker)
PHP Version: 8.0.7
Block user comment: N
Private report: N
New Comment:
Please keep in mind that CRLF for email headers is what's specified in the email RFC.
https://datatracker.ietf.org/doc/html/rfc2822#section-2.2
Previous Comments:
------------------------------------------------------------------------
[2021-06-17 20:15:13] php at shyim dot de
Here is a screenshot of the sent mail. The headers have always two new lines instead one:
https://i.imgur.com/iQEaUyi.png
------------------------------------------------------------------------
[2021-06-17 20:13:02] php at shyim dot de
Description:
------------
Setup:
- Mailhog
- SSMTP
- Configured php.ini to ssmtp -t
Execute the test script with 7.4 and 8.0. The email looks correct in 7.4 and its totally broken on
8.0. The headers are in the body in PHP 8.0.
Test script:
---------------
$to = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
Taken from https://www.php.net/manual/en/function.mail
Expected result:
----------------
The mail is the same on both PHP versions
Actual result:
--------------
It's totally different. The PHP 8.0 doesn't have a subject. I guess it has something done
with https://github.com/php/php-src/commit/6983ae751cd301886c966b84367fc7aaa1273b2d#diff-c6922cd89f6f75912eb377833ca1eddb7dd41de088be821024b8a0e340fed3df
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81158&edit=1
Thread (4 messages)