generated from Nodarx/template
feat: add fetch message size limit
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -61,6 +61,7 @@ class RemoteMailService
|
||||
|
||||
private const COLLECTION_FILTER_OPTIONS = ['name', 'role', 'subscription'];
|
||||
private const DEFAULT_MAILBOX_STATUS_ITEMS = ['MESSAGES', 'UNSEEN', 'RECENT', 'UIDNEXT', 'UIDVALIDITY'];
|
||||
private const LIST_BODY_TEXT_LIMIT = 1048576; // 1 MB
|
||||
|
||||
private ?ImapClient $imapClient = null;
|
||||
private ?SmtpClient $smtpClient = null;
|
||||
@@ -304,7 +305,8 @@ class RemoteMailService
|
||||
*/
|
||||
public function entityList(string $collection, ?IFilter $filter = null, ?ISort $sort = null, ?IRange $range = null): Generator
|
||||
{
|
||||
$options = FetchOptions::message()->withBodyText();
|
||||
// text parts normally precede attachments, so capping TEXT avoids transferring attachment bytes
|
||||
$options = FetchOptions::message()->withBodyText(self::LIST_BODY_TEXT_LIMIT);
|
||||
|
||||
// fast path: fetch all messages without filtering, sorting or pagination
|
||||
if ($filter === null && $sort === null && $range === null) {
|
||||
|
||||
Reference in New Issue
Block a user