Method SaveOutgoingContentAsync
- Namespace
- MailFathom.Application.EmailContent.Storage
- Assembly
- MailFathom.Application.dll
SaveOutgoingContentAsync(IPersistenceSession, OutgoingEmailId, ReadOnlyMemory<byte>, CancellationToken)
Saves the raw MIME one outgoing email will be transmitted as, once and only once.
Task SaveOutgoingContentAsync(IPersistenceSession session, OutgoingEmailId outgoingEmailId, ReadOnlyMemory<byte> rawMime, CancellationToken cancellationToken)
Parameters
sessionIPersistenceSessionThe explicit persistence session this content write participates in.
outgoingEmailIdOutgoingEmailIdThe record of the send this message was composed for.
rawMimeReadOnlyMemory<byte>The composed RFC 822 bytes.
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
sessionis null.- ArgumentException
Thrown when
rawMimeis empty.- InvalidOperationException
Thrown when no outgoing record carries
outgoingEmailId.