Table of Contents

Method GetEmailBatchAfterAsync

Namespace
MailFathom.Application.Synchronization.Sessions
Assembly
MailFathom.Application.dll

GetEmailBatchAfterAsync(ImapUid?, int, MailSynchronizationWindow, CancellationToken)

Gets a bounded remote email metadata page after the supplied checkpoint UID.

Task<RemoteEmailMetadataBatch> GetEmailBatchAfterAsync(ImapUid? lastSeenUid, int maxEmailCount, MailSynchronizationWindow synchronizationWindow, CancellationToken cancellationToken)

Parameters

lastSeenUid ImapUid?

The checkpoint to read past, or null to start at the first assigned UID.

maxEmailCount int

The maximum number of emails the returned page may describe.

synchronizationWindow MailSynchronizationWindow

How far back the page may reach, which the implementation must apply on the server rather than to the answer.

cancellationToken CancellationToken

Cancels the read and every remaining attempt.

Returns

Task<RemoteEmailMetadataBatch>

The page, with the UID it inspected through and whether more work remains.

Remarks

An email the window excludes is not described by the page, and the returned cursor still covers it: the page reports the UID the search inspected through rather than the UID it last described, so a caller advancing its checkpoint by that cursor steps over an excluded range once instead of rescanning it on every run. That is also why the window belongs on the server's side of the call — an excluded UID must cost no fetch.

Exceptions

MailboxUnavailableException

Thrown when the mail server did not serve the read within its configured resilience budget.

MailboxFolderRecreatedException

Thrown when a recovered connection reselected the folder with a different UIDVALIDITY.