fix mail with just PDF / no body or multipart, to fix regular PDF attachments broken after initial fix

This commit is contained in:
ralf 2024-02-28 11:27:15 +02:00
parent 88dc76be3a
commit e42716dd37

View File

@ -6205,8 +6205,9 @@ class Mail
// we need to set content on structure to decode transfer encoding // we need to set content on structure to decode transfer encoding
$part->setContents( $part->setContents(
$this->getBodyPart($_uid, $part->getMimeId(), null, $_preserveSeen, $_stream, $encoding, $fetchAsBinary), $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 // some mailers e.g. "SAP NetWeaver 750" send just the PDF, with no body or multipart
array('encoding' => $fetchAsBinary && $part->getType() === 'application/pdf' ? 'base64' : // 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))); (!$fetchAsBinary&&!$encoding?'8bit':$encoding)));
return $part; return $part;