Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/Fetch/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -562,15 +562,21 @@ protected function processStructure($structure, $partIdentifier = null)
}
}

if (isset($structure->parts)) { // multipart: iterate through each part
if (! empty($structure->parts)) {

foreach ($structure->parts as $partIndex => $part) {
$partId = $partIndex + 1;
if (isset($structure->subtype) && strtolower($structure->subtype) === 'rfc822') {
// rfc822: The root part is processed with the current part identifier
$this->processStructure($structure->parts[0], $partIdentifier);
} else {
// multipart: iterate through each part
foreach ($structure->parts as $partIndex => $part) {
$partId = $partIndex + 1;

if (isset($partIdentifier))
$partId = $partIdentifier . '.' . $partId;
if (isset($partIdentifier))
$partId = $partIdentifier . '.' . $partId;

$this->processStructure($part, $partId);
$this->processStructure($part, $partId);
}
}
}
}
Expand Down