* eSync: fix for messages with no text body e.g. just a PDF or an image, returns empty body with attachment(s)

This commit is contained in:
ralf 2024-03-05 15:29:41 +02:00
parent c44e3f08fa
commit c622e6e88e

View File

@ -954,6 +954,7 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
{
// fetch the body (try to gather data only once)
$css ='';
try {
$bodyStruct = $this->mail->getMessageBody($id, 'html_only', '', null, true,$_folderName);
if ($this->debugLevel>2) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__.' html_only Struct:'.array2string($bodyStruct));
$body = $this->mail->getdisplayableBody($this->mail,$bodyStruct,true,false);
@ -1063,6 +1064,14 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
$output->asbody->estimatedDataSize = 1;
}
}
catch(Api\Exception\WrongParameter $e) {
// we throw, if body is not found, e.g. whole message is a PDF or an image --> return an empty body (1 space)
$output->asbody->type = 1;
$output->nativebodytype = 1;
$output->asbody->data = StringStreamWrapper::Open($error=' '); //$e->getMessage().' ('.$e->getCode().')');
$output->asbody->estimatedDataSize = strlen($error);
}
}
}
// end AS12 Stuff
ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__.' gather Header info:'.$headers['subject'].' from:'.$headers['date']);