Commit a5c4cfc4 authored by Manfred Kutas's avatar Manfred Kutas

ZP-1052 Attached eml message does not have size.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 6ce31187
......@@ -748,7 +748,15 @@ class MAPIProvider {
// android devices require attachment size in order to display an attachment properly
if (!isset($attachprops[PR_ATTACH_SIZE])) {
$stream = mapi_openpropertytostream($mapiattach, PR_ATTACH_DATA_BIN);
$stat = mapi_stream_stat($stream);
// It's not possible to open some (embedded only?) messages, so we need to open the attachment object itself to get the data
if (mapi_last_hresult()) {
$embMessage = mapi_attach_openobj($mapiattach);
$addrbook = $this->getAddressbook();
$stream = mapi_inetmapi_imtoinet($this->session, $addrbook, $embMessage, array('use_tnef' => -1));
}
else {
$stat = mapi_stream_stat($stream);
}
$attach->estimatedDataSize = $stat['cb'];
}
else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment