mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 23:55:55 +08:00
Resolve #190
This commit is contained in:
parent
f8da8b5135
commit
58d02fa2e7
|
@ -218,27 +218,30 @@ class BodyStructure
|
|||
|
||||
public function GetHtmlAndPlainParts() : array
|
||||
{
|
||||
$aParts = $this->SearchByCallback(function ($oItem) {
|
||||
$aParts = [];
|
||||
|
||||
$gParts = $this->SearchByCallback(function ($oItem) {
|
||||
return ('text/html' === $oItem->sContentType || 'text/plain' === $oItem->sContentType)
|
||||
&& !$oItem->IsAttachBodyPart();
|
||||
});
|
||||
|
||||
if ($aParts->valid()) {
|
||||
return \array_merge([$aParts->current()], \iterator_to_array($aParts));
|
||||
foreach ($gParts as $oPart) {
|
||||
$aParts[] = $oPart;
|
||||
}
|
||||
|
||||
/**
|
||||
* No text found, is it encrypted?
|
||||
* If so, just return that.
|
||||
*/
|
||||
$gEncryptedParts = $this->SearchByContentType('multipart/encrypted');
|
||||
foreach ($gEncryptedParts as $oPart) {
|
||||
if ($oPart->IsPgpEncrypted() && $oPart->SubParts()[1]->IsInline()) {
|
||||
return array($oPart->SubParts()[1]);
|
||||
if (!$aParts) {
|
||||
$gEncryptedParts = $this->SearchByContentType('multipart/encrypted');
|
||||
foreach ($gEncryptedParts as $oPart) {
|
||||
if ($oPart->IsPgpEncrypted() && $oPart->SubParts()[1]->IsInline()) {
|
||||
return array($oPart->SubParts()[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [];
|
||||
return $aParts;
|
||||
}
|
||||
|
||||
public function SearchCharset() : string
|
||||
|
|
Loading…
Reference in a new issue