Open
Description
Describe the bug
According to RFC 1341 a message flagged as 'Content-Transfer-Encoding: binary' should not be converted but kept 'as is'.
Problem is:
switch ($encoding) {
case IMAP::MESSAGE_ENC_BINARY:
if (extension_loaded('imap')) {
return base64_decode(\imap_binary($value));
}
return base64_decode($value);
source: MessageDecoder always applies base64_decode on the content.
This is wrong, and produces broken output.
This is a multi-part message in MIME format.
------=_Part_72_1430376836.1740153200721
Content-Type: text/html; charset=iso-8859-15
Content-Transfer-Encoding: binary
<body> <div style="font-size: 10pt; font-family: Arial, sans-serif; width:600px"> <div style="padding-bottom=15pt">Sehr geehrte Damen und Herren,</div> <br> <div style="padding-bottom=5pt">vielen Dank für Ihre Bestellung, bitte beachten Sie das Prüfzeugnis im Anhang.</div></body>
------=_Part_72_1430376836.1740153200721
Content-Type: application/pdf; name=Pruefzeugnis_PZ-2025-0075307.pdf
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=Pruefzeugnis_PZ-2025-0075307.pdf
Content-ID: <Pruefzeugnis_PZ-2025-0075307.pdf>
...
will result in a broken output.
nrv+)^~ȳ{])'ښ)r�Ƨ�'aM)دܥzv)-Rz�ykڙޮدnbrZuا&o^6ZȆz^[imzty֬>Wz'Ȧ�xZ�݊ۡ
Would be nice if this could be fixed to comply with RFC 1341.