draft code for TNEF winmail.dat #1012

This commit is contained in:
the-djmaze 2024-03-06 02:31:28 +01:00
parent 8fe5cd3c95
commit 565e8f0fb7
37 changed files with 5073 additions and 16 deletions

View file

@ -515,6 +515,29 @@ trait Messages
} catch (\Throwable $e) {
$this->logException($e);
}
/*
if (!$oMessage->sPlain && !$oMessage->sHtml && !$oMessage->pgpEncrypted && !$oMessage->smimeEncrypted) {
$aAttachments = $oMessage->Attachments ?: [];
foreach ($aAttachments as $oAttachment) {
// \in_array($oAttachment->ContentType(), ['application/vnd.ms-tnef', 'application/ms-tnef'])
if ('winmail.dat' === \strtolower($oAttachment->FileName())) {
$sData = $this->ImapClient()->FetchMessagePart(
$oMessage->Uid,
$oAttachment->PartID()
);
$oTNEF = new \TNEFDecoder\TNEFAttachment;
$oTNEF->decodeTnef($sData);
foreach ($oTNEF->getFiles() as $oFile) {
if (\in_array($oFile->type, ['application/rtf', 'text/rtf'])) {
$rtf = new \SnappyMail\Rtf\Document($oFile->content);
$oMessage->setHtml($rtf->toHTML());
}
}
break;
}
}
}
*/
}
catch (\Throwable $oException)
{