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

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.

Replacing a 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 owner 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 owner 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.

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(IMailboxWriteSessionFactory, MailboxDestinationResolver, IEmailContentStore, IMailDraftStore, IMailTransportSecurityPolicyReader, OptimisticConcurrencyRetryPolicy, TimeProvider)

Initializes the filer from the session it appends 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.