Table of Contents

Class OutgoingMailGovernor

Namespace
MailFathom.Application.Mail.Delivery.Governance
Assembly
MailFathom.Application.dll

Decides whether this deployment may send a message at all, before a record of it exists.

public sealed class OutgoingMailGovernor
Inheritance
OutgoingMailGovernor
Inherited Members

Remarks

Three questions in one place because they are one decision with one answer: whether the capability is held, whether the people named may be written to, and whether the period has room. Each is the operator's rather than any author's, so a caller, a rule, a command, and a protocol added later all meet them identically.

It is asked by the outbox rather than by an entrypoint, which is what makes it unbypassable: enforcing any of the three in a caller would leave the caller added next to re-enforce it, and a bound with as many implementations as it has callers is a bound with as many holes.

The order is capability, recipients, ceiling, and it is the order of cost. A deployment that cannot send is answered without reading anything; a policy refusal is decided in memory; and only a send that has passed both reads the period's counts from the database, which a deployment declaring no ceiling never does at all.

Constructors

OutgoingMailGovernor(IOutgoingSendPermissionReader, OutgoingRecipientPolicy, OutgoingMailCeilings, IOutgoingMailUsageReader, TimeProvider)

Decides whether this deployment may send a message at all, before a record of it exists.

Methods

RequirePermittedAsync(OutgoingEmailRequest, CancellationToken)

Requires that this deployment may send the message a request describes.