Table of Contents

Class MailDraftPromotion

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

Turns one draft into an ordinary send, carrying the bytes the draft already is.

public sealed class MailDraftPromotion
Inheritance
MailDraftPromotion
Inherited Members

Remarks

A promoted draft is not a second kind of send. What comes out is the outgoing record every other send is written down as, transmitted through the same outbox and filed by the same mechanism, and what goes in is the stored MIME the drafts folder already shows — so the message the user read in their own mail client is byte for byte the message their correspondent receives. Nothing is recomposed, which is what keeps the Message-ID the one the draft has been carrying.

Every bound this deployment sets is asked again here, not only when the draft was written. A draft may have been composed months before the recipient policy was tightened, the ceilings were lowered, or sending was turned off for the account — so the answer that matters is the one that holds at the moment the message would leave. Two governors answer between them: the outbox's, which says what this deployment may send at all, and the authored one asked here, which says what this caller may be talked into. The size the deployment composes is compared against the bytes actually stored rather than against what was measured when they were composed.

The authored governor is asked here rather than by the outbox for the reason it is asked by the two submissions: it bounds a caller, and the outbox runs for work nobody asked for as well. That is what makes a draft an ordinary send on this side too — the per-caller ceiling, the posture on a recipient nothing here vouches for, and the audit row are the same three a direct send meets, and the addresses they are asked about are the draft's own, judged against the contact book as it stands now rather than as it stood when the draft was written.

A promotion that fails leaves the draft exactly as it was. Nothing about the draft is written until the outgoing record exists, so a refused recipient, a full period, an account that has since been turned read-only, and a message too large all leave the user the draft they wrote.

The draft is not deleted here either. The record is queued rather than sent, so the copy in the drafts folder stands until the message has actually been delivered, and the pass that settles the send is what gives the draft up.

Constructors

MailDraftPromotion(IMailDraftStore, IEmailContentStore, MailOutbox, IOutgoingEmailStore, OptimisticConcurrencyRetryPolicy, OutgoingEmailBounds, AuthoredSendGovernor, AccessAuthorization)

Initializes the promotion from the draft it reads and the outbox it writes the send into.

Methods

PromoteAsync(MailDraftId, UserId, CancellationToken)

Queues one draft for delivery, or refuses it naming what stopped it.