You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mb_send_mail may delimit headers with LF only #7902
The mail is sent with proper base64 encoded body, but because of a problem in mail header the receiving client cannot decode it. It seems that mb_send_mail() adds a Content-Transfer-Encoding element to the mail header without any linefeed separation after the user supplied header elements:
I tried to add extra trailing LF or extra CRLF to my $header and tried both array and string concatenated versions, but it seems php strips any user-supplied trailing linefeeds.
Works in PHP 7.4.
A similar bug was reported in 2021/06 at https://bugs.php.net/bug.php?id=81158 and was reclassified as documentation problem, but imho my above bug report is slightly different because Content-Transfer-Encoding is not set by me but the php function.
The only workaround I found was to use mail() directly, with manually setting Content-Transfer-Encoding header and manually passing base64_encode($message) to mail. But that is a less generic solution than mb_send_mail(), which would support several mb_language() settings.
I am not familiar with php-src to dare a pull request, though it seems that this part is it:
changed the title [-]mb_send_mail sends broken header in PHP 8.0 (possible cause: Content-Transfer-Encoding added without CRLF separation) [/-][+]mb_send_mail may delimit headers with LF only[/+]on Jan 7, 2022
Activity
cmb69 commentedon Jan 7, 2022
Thanks for reporting this issue! Indeed, we're still using hard-coded LF instead of CRLF for mb_send_mail().
Fix phpGH-7902: mb_send_mail may delimit headers with LF only
[-]mb_send_mail sends broken header in PHP 8.0 (possible cause: Content-Transfer-Encoding added without CRLF separation) [/-][+]mb_send_mail may delimit headers with LF only[/+]Fix GH-7902: mb_send_mail may delimit headers with LF only
Merge branch 'PHP-8.0' into PHP-8.1
Merge branch 'PHP-8.1'