Table of Contents

Method SaveMailDraftContentAsync

Namespace
MailFathom.Application.EmailContent.Storage
Assembly
MailFathom.Application.dll

SaveMailDraftContentAsync(IPersistenceSession, MailDraftId, PlacedEmailContent, CancellationToken)

Saves the raw MIME one revision of a draft is held as, replacing whatever the previous revision stored.

Task SaveMailDraftContentAsync(IPersistenceSession session, MailDraftId draftId, PlacedEmailContent placedContent, CancellationToken cancellationToken)

Parameters

session IPersistenceSession

The explicit persistence session this content write participates in.

draftId MailDraftId

The draft this message is the current revision of.

placedContent PlacedEmailContent

What PlaceContentAsync(EmailContentKind, ReadOnlyMemory<byte>, CancellationToken) answered for this payload.

cancellationToken CancellationToken

Propagates caller cancellation.

Returns

Task

A task that completes after durable storage.

Remarks

This is the one raw-MIME write in this system that overwrites, and the difference from the outgoing one is the whole reason a draft is not an outgoing record. A send's payload is written once because a retry has to transmit the bytes an earlier attempt may already have begun transmitting; a draft's payload is what its author is still editing, and holding every version of it would keep a message per keystroke for as long as the draft lives.

It joins the caller's session because the payload and the revision it belongs to are one decision: a draft whose row says revision three and whose bytes are revision two is a draft that would be appended wrongly and promoted wrongly, so the two commit together or neither does.

Exceptions

ArgumentNullException

Thrown when session or placedContent is null.

InvalidOperationException

Thrown when no draft is held under draftId.