Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process root element of embedded emails #201

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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