generated from Nodarx/template
feat: serve message fetches from the cache
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -480,6 +480,31 @@ class LiveMailService
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the full, decoded content of body sections of one message.
|
||||
*
|
||||
* @param string[] $partIds e.g. ['1.2']
|
||||
* @return array<string, string> content keyed by part id; sections the server did not return are absent
|
||||
*/
|
||||
public function messageSections(string $collection, int $uid, string ...$partIds): array
|
||||
{
|
||||
if ($partIds === []) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// BODYSTRUCTURE lets the parser decode each section by its transfer encoding and charset
|
||||
$options = FetchOptions::of('BODYSTRUCTURE');
|
||||
foreach ($partIds as $partId) {
|
||||
$options = $options->withBodySection($partId);
|
||||
}
|
||||
|
||||
foreach ($this->messageFetch($collection, $options, $uid) as $message) {
|
||||
return array_intersect_key($message->bodySections(), array_flip($partIds));
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Stream the raw bytes of a message or a specific MIME part without buffering.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user