Method SynchronizeAsync
- Namespace
- MailFathom.Application.Synchronization
- Assembly
- MailFathom.Application.dll
SynchronizeAsync(MailAccountId, MailFolderMapping, CancellationToken)
Synchronizes one configured folder alias without mutating remote mailbox flags.
public Task<MailboxSynchronizationResult> SynchronizeAsync(MailAccountId accountId, MailFolderMapping folderMapping, CancellationToken cancellationToken)
Parameters
accountIdMailAccountIdThe account to synchronize.
folderMappingMailFolderMappingWhat configuration says the alias names.
cancellationTokenCancellationTokenCancels the run between remote reads and local writes.
Returns
- Task<MailboxSynchronizationResult>
The bounded progress this run committed, or the reason the alias named no remote folder.
Remarks
The alias is resolved against the server's advertised folders before anything is read, so a run always works under the binding that is durable at the moment it starts. An alias the server advertises no folder for ends this run and no other.
The account's synchronization window is read at the same moment as its transport security policy and bounds every batch the run requests. Excluded mail is left out by the server, so it costs no fetch, no MIME read, and no local write, and the folder checkpoint still advances across the excluded range so a run ends instead of rescanning it on every interval.
Exceptions
- ArgumentNullException
Thrown when
folderMappingis null.- MailTransportSecurityPolicyViolationException
Thrown when the account's configured transport security policy is unsafe, before any connection is attempted.
- PersistenceConcurrencyConflictException
Thrown when a competing writer wins a race that the bounded local retries could not resolve. Progress already committed by this run stays durable, and the next run rereads the committed checkpoint before deciding again.
- MailboxUnavailableException
Thrown when the mail server did not serve the run within its configured resilience budget. Progress already committed stays durable and the next run resumes from the persisted checkpoint.
- MailboxFolderRecreatedException
Thrown when a recovered connection reselected the folder with a different UIDVALIDITY, so the identities this run was working with no longer name the same emails. The next run starts the folder over.