Class AuthoredMailSubmission
- Namespace
- MailFathom.Application.Mail.Delivery.Submission
- Assembly
- MailFathom.Application.dll
Takes a message somebody wrote and queues it, which is the whole of what asking to send does.
public sealed class AuthoredMailSubmission
- Inheritance
-
AuthoredMailSubmission
- Inherited Members
Remarks
It is the one use case a boundary reaches to send a new message, and it composes the three steps that were already each proven on their own: the people named become addresses, the addresses and the text become MIME, and the MIME and the request become a durable record. Composing them here rather than at each entrypoint is what keeps a second protocol from doing two of the three and inventing the middle one.
Nothing here transmits, and no configuration makes it. What comes back is the record the message was written down as, at the stage a delivery pass reads and continues from, which is why a caller is told the message is queued rather than sent. That is ADR 0013's fixed part, and it is structural rather than enforced: this use case holds no delivery session and no factory for one, so there is nothing here that could open a submission channel.
The message is composed against BeforeAnyServerHasSpoken rather than against a session, for the same reason: the server that will carry the message is not being talked to and must not be, so the composition is held to the answers that stay correct whatever it turns out to say. What the server does decide — whether the message is within the size it advertises — is asked again by the delivery pass against the length that was stored, so nothing is lost by not asking now.
A message asked to leave at a named time is composed exactly as one asked to leave at once, and differs only in what the outbox is told. Nothing about the time reaches the MIME — a held message is byte-for-byte the message it would have been — so the hold is a property of the record rather than of the mail, and a caller reading the answer sees the same queued identifier either way.
The grant is asked for here and again by the outbox, and the two are not a duplicate. This one refuses before the contact book is read and before anything is composed, so a caller without it spends nothing and learns nothing about who is in the book; the outbox's is the authority, asked with no boundary in the picture so that an entrypoint added later meets it whatever it did first.
Constructors
- AuthoredMailSubmission(IMailAccountCatalog, NamedRecipientResolver, IAuthoredEmailComposer, MailOutbox, AuthoredSendGovernor, AccessAuthorization, TimeProvider)
Takes a message somebody wrote and queues it, which is the whole of what asking to send does.
Methods
- SubmitAsync(MailSubmissionRequest, CancellationToken)
Queues one message, or refuses it naming what the caller has to change.