From 9d96eb7875f28d4a3ae0ec6e979dd6bcffa25183 Mon Sep 17 00:00:00 2001 From: ralf Date: Wed, 28 Feb 2024 11:27:15 +0200 Subject: [PATCH] fix mail with just PDF / no body or multipart, to fix regular PDF attachments broken after initial fix --- api/src/Mail.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/src/Mail.php b/api/src/Mail.php index 751d10157a..464c6dc839 100644 --- a/api/src/Mail.php +++ b/api/src/Mail.php @@ -6202,8 +6202,9 @@ class Mail // we need to set content on structure to decode transfer encoding $part->setContents( $this->getBodyPart($_uid, $part->getMimeId(), null, $_preserveSeen, $_stream, $encoding, $fetchAsBinary), - // some mailer e.g. "SAP NetWeaver 750" set not transfer-encoding for pdf --> use base64 when fetching as binary - array('encoding' => $fetchAsBinary && $part->getType() === 'application/pdf' ? 'base64' : + // some mailers e.g. "SAP NetWeaver 750" send just the PDF, with no body or multipart + // AND therefore NO transfer-encoding --> use base64 when fetching as binary + array('encoding' => !isset($part->parent) && $fetchAsBinary && $part->getType() === 'application/pdf' ? 'base64' : (!$fetchAsBinary&&!$encoding?'8bit':$encoding))); return $part;