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
Subject: =?iso-8859-1?Q?Onlinetreffen Starke Leistungen - fairer Beitrag: Das sollten ver.di Mitgli= eder unbedingt wissen 14.05.2024 17:00:00?=
But I expected this header instead:
Subject: =?iso-8859-1?Q?Onlinetreffen Starke Leistungen - fairer Beitrag: Das sollten ver.di Mitgli=
eder unbedingt wissen 14.05.2024 17:00:00?=
This happens because quoted_printable_encode() wraps lines at 75 characters and therefore inserts a "=\r\n" but the mail() function replaces every control character, that is not a \r followed by \n followed by space, with a space.
So quoted_printable_encode() should insert an additional space to prevent mail() from replacing the \r\n with spaces or the check in mail() should not check for a space after "\r\n" but for a "=" before the "\r\n"
(Soft Line Breaks) The Quoted-Printable encoding REQUIRES that encoded lines be no more than 76 characters long. If longer lines are to be encoded with the Quoted-Printable encoding, "soft" line breaks must be used. An equal sign as the last character on a encoded line indicates such a non-significant ("soft") line break in the encoded text.
Perhaps quoted_printable_encode() is not the right function to encode the subject for the mail() function? How do you encode it then?
Description
The following code:
Resulted in an email with this header:
But I expected this header instead:
This happens because quoted_printable_encode() wraps lines at 75 characters and therefore inserts a "=\r\n" but the mail() function replaces every control character, that is not a \r followed by \n followed by space, with a space.
So quoted_printable_encode() should insert an additional space to prevent mail() from replacing the \r\n with spaces or the check in mail() should not check for a space after "\r\n" but for a "=" before the "\r\n"
https://github.com/php/php-src/blob/master/ext/standard/quot_print.c#L175
https://github.com/php/php-src/blob/master/ext/standard/mail.c#L307
https://github.com/php/php-src/blob/master/ext/standard/mail.c#L49
PHP Version
current version, see links to sourcecode
Operating System
No response
The text was updated successfully, but these errors were encountered: