consider more parts of an email as attachment, even so it may not fully match the needed params. this way, at least we show it in the attachment list

This commit is contained in:
Klaus Leithoff 2014-10-17 13:11:47 +00:00
parent 850836be8a
commit a00999023a

View File

@ -1464,10 +1464,14 @@ class emailadmin_imapbase
$part = $mailStructureObject->getPart($mime_id); $part = $mailStructureObject->getPart($mime_id);
$partdisposition = $part->getDisposition(); $partdisposition = $part->getDisposition();
$partPrimaryType = $part->getPrimaryType(); $partPrimaryType = $part->getPrimaryType();
//error_log(__METHOD__.' ('.__LINE__.') '.' Uid:'.$uid.'->'.$mime_id.' Disp:'.$partdisposition.' Type:'.$partPrimaryType);
$cid = $part->getContentId(); $cid = $part->getContentId();
if (empty($partdisposition) && $partPrimaryType != 'multipart' && $partPrimaryType != 'text') if (empty($partdisposition) && $partPrimaryType != 'multipart' && $partPrimaryType != 'text')
{ {
$partdisposition=($partPrimaryType == 'image'&&!empty($cid)?'inline':'attachment'); // the presence of an cid does not necessarily indicate its inline. it may lack the needed
// link to show the image. Considering this: we "list" everything that matches the above criteria
// as attachment in order to not loose/miss information on our data
$partdisposition='attachment';//($partPrimaryType == 'image'&&!empty($cid)?'inline':'attachment');
} }
if ($mime_type=='message/rfc822') if ($mime_type=='message/rfc822')
{ {
@ -4847,6 +4851,14 @@ class emailadmin_imapbase
//error_log(__METHOD__.' ('.__LINE__.') '.' Uid:'.$uid.'->'.$mime_id.':'.array2string($part->contentTypeMap())); //error_log(__METHOD__.' ('.__LINE__.') '.' Uid:'.$uid.'->'.$mime_id.':'.array2string($part->contentTypeMap()));
foreach($part->contentTypeMap() as $sub_id => $sub_type) if ($sub_id != $mime_id) $skipParts[$sub_id] = $sub_type; foreach($part->contentTypeMap() as $sub_id => $sub_type) if ($sub_id != $mime_id) $skipParts[$sub_id] = $sub_type;
} }
if (empty($partDisposition) && $partPrimaryType != 'multipart' && $partPrimaryType != 'text')
{
// the absence of an partDisposition does not necessarily indicate there is no attachment. it may be an
// attachment with no link to show the attachment inline.
// Considering this: we "list" everything that matches the above criteria
// as attachment in order to not loose/miss information on our data
$partDisposition='attachment';
}
//error_log(__METHOD__.' ('.__LINE__.') '.' Uid:'.$uid.' Part:'.$_partID.'->'.$mime_id.':'.array2string($skipParts)); //error_log(__METHOD__.' ('.__LINE__.') '.' Uid:'.$uid.' Part:'.$_partID.'->'.$mime_id.':'.array2string($skipParts));
if (array_key_exists($mime_id,$skipParts)) continue; if (array_key_exists($mime_id,$skipParts)) continue;