Class OutgoingMailFiler
- Namespace
- MailFathom.Application.Mail.Delivery.Filing
- Assembly
- MailFathom.Application.dll
Puts a copy of an outgoing message into the folder the message's own state calls for.
public sealed class OutgoingMailFiler
- Inheritance
-
OutgoingMailFiler
- Inherited Members
Remarks
One mechanism for every place a message MailFathom authored belongs: a draft in the drafts folder, a message still waiting in the folder an operator mapped as the outbox, a delivered message in the sent folder. What differs between them is the role of the destination and the flags the copy carries, and both travel on OutgoingMailFiling — so a fourth place is a member there rather than a second filer here.
The destination is found by role and never by name, because every one of these folders is spelled differently in every locale and by every provider. A role no folder of the account plays is a destination that is not available, which is the same answer a mapped folder the server does not advertise gives: the account's folder mapping is what changes it, and the message is untouched either way.
The append itself is MailboxCopyAppender's, and with it the order of the two writes that is the whole of the safety here: the row is durable at Issued before the command goes out, and a row found there is reported rather than appended again. What stays here is which row moves and what a copy that could not be filed means for the send it belongs to.
Nothing here can fail a delivery. A send whose copy could not be filed is a send that happened, so the failure is written beside the delivery stage rather than over it, and no delivery is ever attempted again because of one.
Constructors
- OutgoingMailFiler(MailboxCopyAppender, IMailboxWriteSessionFactory, MailboxDestinationResolver, IOutgoingMailFilingStore, IMailTransportSecurityPolicyReader, OptimisticConcurrencyRetryPolicy, TimeProvider)
Initializes the filer from the append it files through and the record it writes the copy onto.
Methods
- FileAsync(OutgoingEmailRecord, OutgoingMailFiling, CancellationToken)
Files one copy of a message into the place its state calls for.
- WithdrawAsync(OutgoingEmailRecord, OutgoingMailFiling, CancellationToken)
Takes a copy back out of the folder it was filed into.