Table of Contents

Class MailDraftFiler

Namespace
MailFathom.Application.Mail.Delivery.Drafts
Assembly
MailFathom.Application.dll

Brings the drafts folder of one mailbox into step with one draft this deployment holds.

public sealed class MailDraftFiler
Inheritance
MailDraftFiler
Inherited Members

Remarks

On a mirrored account it is the same filing mechanism a sent copy goes through, specialized to the one message whose copy has to change. The role and the flags are Draft's, the folder is found by that role and never by name, and the append and the withdrawal are the two operations the write session opens for exactly this. What is not shared is the record: a filed copy is written once and kept, and a draft's copy is written, replaced, and taken back out, so the durable account of it hangs off the draft rather than off an outgoing record.

On an account MailFathom holds alone nothing below reaches a server: the revision is filed into the local drafts folder and the message it replaced is erased in one commit, with no append and no removal, as FileLocallyAsync(IPersistenceSession, MailDraftId, int, LocalMailCopy, CancellationToken) describes.

Replacing a mirrored draft is an append followed by a removal, in that order, and the order is the safety. IMAP has no command that changes a stored message. Removing first and then failing to append leaves the user with no draft at all — the version they were working on, gone — while appending first and then failing to remove leaves them with two, which is untidy and loses nothing. The revision is durable before either command goes out, so a process that dies between them is recognized by MailDraftStage and the resumed attempt finishes the pair.

The only occurrence this can ever name is one an append of its own reported. There is no path here from a caller-supplied UID, a folder search, or a message identity to a removal, so a draft the user wrote in their own mail client is unreachable by construction rather than by a check. Where the tracked occurrence stops being provably that copy — the role now resolves elsewhere, the folder was recreated, the server named no placement, an append was never answered — the copy is left exactly where it is and the divergence is written onto the draft.

The copy is the mailbox's mail, whoever wrote the draft. The drafts folder belongs to the account, so a revision filed into it is read by every user the account is assigned to, while the draft record behind it stays its author's alone. That is the limit of what the author term buys, and it is stated here because this is what writes the copy; MailDraftBook carries the reasoning.

Nothing here raises for a copy that could not be settled. The draft itself is unharmed by any of it, and a failure that ended the pass would leave the drafts beside this one unsettled over something that says nothing about them.

Constructors

MailDraftFiler(MailboxCopyAppender, LocalMailFiler, IMailboxWriteSessionFactory, MailboxDestinationResolver, IMailDraftStore, IMailTransportSecurityPolicyReader, OptimisticConcurrencyRetryPolicy, TimeProvider)

Initializes the filer from the append it files through and the record it writes each copy onto.

Methods

SettleAsync(MailDraftRecord, CancellationToken)

Does whatever one draft's recorded stage says the mailbox is owed, and records what happened.