Table of Contents

Method DeleteAsync

Namespace
MailFathom.Application.Mail.Mutations
Assembly
MailFathom.Application.dll

DeleteAsync(EmailOccurrenceId, AuthoredDeleteServerDisposition, IMailboxMutationJournal, CancellationToken)

Removes one email from this session's folder on the server.

Task DeleteAsync(EmailOccurrenceId occurrenceId, AuthoredDeleteServerDisposition serverDisposition, IMailboxMutationJournal journal, CancellationToken cancellationToken)

Parameters

occurrenceId EmailOccurrenceId

The occurrence to remove, which must belong to this session's account, folder, and UIDVALIDITY.

serverDisposition AuthoredDeleteServerDisposition

Whether the email is expunged or only flagged \Deleted, as the delete was recorded under.

journal IMailboxMutationJournal

The durable record of this deletion, which the session announces each stage to and resumes from.

cancellationToken CancellationToken

Cancels the deletion.

Returns

Task

A task that completes when the server has removed the email, or flagged it where only that was asked for.

Remarks

What becomes of the local copy is not decided here. This operation says what the server now does with the message, and nothing else, so an account's disposition for mail somebody else deleted never silently governs mail MailFathom deleted. The remote \Seen flag is untouched.

Exceptions

ArgumentException

Thrown when occurrenceId does not belong to this session.

ArgumentNullException

Thrown when journal is null.

MailboxMutationUnsupportedException

Thrown when the server advertises no UIDPLUS, so no message-scoped expunge exists. A delete that only flags is refused on the same server as well, so what a server can delete does not depend on an account setting.

MailboxUnavailableException

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

MailboxFolderRecreatedException

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