From 8a9e75360c0fbf3012f32db4cb72dee5e3387114 Mon Sep 17 00:00:00 2001 From: ralf Date: Tue, 5 Mar 2024 20:03:18 +0200 Subject: [PATCH] fixing the fix, only set binary, if it has not content-transfer-encoding header with value base64 --- api/src/Mail.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/api/src/Mail.php b/api/src/Mail.php index f6d16a547c..74bf1c11e9 100644 --- a/api/src/Mail.php +++ b/api/src/Mail.php @@ -7323,8 +7323,11 @@ class Mail $structure->setTransferEncoding('8bit'); $structure->setCharset('utf-8'); } - // if we have no text body, but only a PDF or an image, set binary, as it's already base64 transfer-encoded - if ($structure->getType() === 'application/pdf' || $structure->getPrimaryType() === 'image') + // if we have no text body, but only a PDF or an image AND transfer-encoding is NOT base64, + // set binary, as it's already base64 transfer-encoded but lacks the necessary header + if (($structure->getType() === 'application/pdf' || $structure->getPrimaryType() === 'image') && + // hack to read protected $structure->_transfer_encoding + unserialize($structure->serialize())[9] !== 'base64') { $structure->setTransferEncoding('binary', ['send' => true]); }