Method SaveOutgoingContentAsync
- Namespace
- MailFathom.Application.EmailContent.Storage
- Assembly
- MailFathom.Application.dll
SaveOutgoingContentAsync(IPersistenceSession, OutgoingEmailId, PlacedEmailContent, CancellationToken)
Saves the raw MIME one outgoing email will be transmitted as, once and only once.
Task SaveOutgoingContentAsync(IPersistenceSession session, OutgoingEmailId outgoingEmailId, PlacedEmailContent placedContent, CancellationToken cancellationToken)
Parameters
sessionIPersistenceSessionThe explicit persistence session this content write participates in.
outgoingEmailIdOutgoingEmailIdThe record of the send this message was composed for.
placedContentPlacedEmailContentWhat PlaceContentAsync(EmailContentKind, ReadOnlyMemory<byte>, CancellationToken) answered for this payload.
cancellationTokenCancellationTokenPropagates caller cancellation.
Returns
- Task
A task that completes after durable storage.
Remarks
A message already stored for this record is left exactly as it is, and that is the contract rather than a
tolerated repeat. A retry has to transmit the bytes an earlier attempt may already have begun transmitting: a
message recomposed between attempts carries a different Message-ID, which turns one message into two in
every recipient's thread, and rewriting the payload under a record that is mid-transmission would change what
was sent after it was sent.
It joins the caller's session for the reason the incoming write does, and more strongly: a record whose message was never stored has nothing to transmit, so the two commit together or neither does.
Exceptions
- ArgumentNullException
Thrown when
sessionorplacedContentis null.- InvalidOperationException
Thrown when no outgoing record carries
outgoingEmailId.