4SO Mail Gateway flow: Accept mail, Inspect and classify, Queue and route, Deliver reliably, Observe and optimize.

MAIL PLATFORM / GATEWAY

4SO Mail GatewayOutbound Delivery · Inbound Protection · Lifecycle

An independent Mail Platform for teams that want to run Outbound Delivery, Inbound Protection, Domain Identity, Queue, Deliverability, lifecycle and Observability as one product.

Outbound DeliveryInbound ProtectionMulti-tenantSelf-hosted

4SO Mail Gateway components: the message path from ingress to delivery

  1. 1Stable ingressHAProxy provides stable transport and HA endpoints for submission and receiving.
  2. 2Protection chainSPF, DKIM, DMARC and ARC plus Rspamd and ClamAV before any backend or quarantine outcome.
  3. 3Queue & spoolKumoMTA owns submission, queue and delivery; the spool is node-local, not shared.
  4. 4Routing & shapingA product-controlled Unbound resolver path, with Valkey for shared runtime data where required.
  5. 5Sending identity & DKIMSending pools, DKIM and DNS readiness move with the domain lifecycle.
  6. 6DestinationsDelivery with explicit state; queue, TLS and deliverability signals land in Prometheus and Grafana.
  7. 7Control PlaneRust Control API with PostgreSQL, Keycloak identity, OpenFGA authorization and OpenBao for secrets and recovery.
  8. 8Human approvalHigh-risk IAM changes: durable job, separate approval, execute-time reauthorization and post-check.
01PROBLEM & OUTCOME

Product problem

Enterprise email is more than sending and receiving messages.

Delivery, Reputation, DKIM, Queue, Inbound Security, Quarantine, Feedback and recovery each have their own failure modes. Mail Gateway brings these components into one coherent operating model.

01DELIVERABILITY

Deliverability is a process

Routing, Shaping, Suppression, Warm-up and Feedback have to be seen together.

02PROTECTION

Receiving needs layered defense

Authentication, Anti-spam, Anti-malware, Quarantine and Backend policy form a single chain.

03TENANCY

Domains and tenants have operational boundaries

Sender authorization, access and sensitive changes are executed within the correct domain.

04LIFECYCLE

Nodes and the Control Plane have a lifecycle too

Provisioning, Drain, Switchover, Upgrade, Backup and recovery are part of the product itself.

02CAPABILITY SNAPSHOT

Capability snapshot

Outbound and Inbound on one platform, with clear boundaries.

Mail Gateway runs the sending, receiving and operations paths with a shared access model and shared observability.

01OUTBOUND

High-volume sending

Authenticated submission, routing, queue and delivery from the Mail Data Plane.

02DKIM & DOMAINS

Domain identity and DKIM

Domain authorization and the lifecycle of the sending signature.

03REPUTATION

Reputation and Suppression

Bounce, Complaint, Suppression and Warm-up management to protect Deliverability.

04INBOUND AUTH

SPF / DKIM / DMARC / ARC

Authentication and evaluation of inbound messages on the Receiver path.

05PROTECTION

Anti-spam / Anti-malware

A protection chain that runs before delivery to the Backend or Quarantine.

06QUARANTINE

Quarantine workflow

Hold, Release, Delete and Expiry with controlled access.

07OBSERVABILITY

Queue and Delivery Visibility

Health, Routing, TLS, Queue and Deliverability in a single operational view.

08RECOVERY

Backup, PITR and recovery

Control Plane and mail-node lifecycle with defined recovery paths.

4SO

The Mail Data Plane does not depend on an LLM to send or receive mail; the mail-serving path is deterministic.

03DEPLOYMENT PROFILES

Deployment model

The Control Plane and mail nodes scale independently.

The product starts from a simple Control Plane and can grow into an HA Control Plane with multiple Mail Nodes for Outbound and Inbound roles; the Manager never enters the Mail Data Plane.

ProfileControl PlaneMail Data PlaneUse case
Single ManagerOne ManagerOne or more Mail NodesSimple deployment and central management
Distributed Mail NodesCentral Control PlaneSeparate nodes for Outbound / InboundSeparation of capacity and Data Plane roles
HA Control PlaneMultiple ManagersIndependent Mail Node PoolManagement redundancy without the Manager entering the Mail Data Plane
Recovery-readyControl Plane + Backup/PITRRebuildable node lifecycleControlled recovery after failure
04ARCHITECTURE

Architecture

The Control Plane decides; the Data Plane moves the mail.

Identity, Authorization, Tenant state and lifecycle live in the Control Plane; SMTP, Queue and Protection run on the mail nodes.

EXPERIENCEAdmin / Customer UI & APIDomain, Campaign, Routing, Inbound policy and operator actions.
↓
CONTROLMail Control PlanePostgreSQL, Identity, Authorization and Secret workflows.
↓
OPERATIONSDurable OperationsProvisioning, Approval, Activation, Rollback and recovery.
↓
DATA PLANEMail NodesKumoMTA/SMTP, Queue, Receiver, Protection and the Delivery runtime.
PlaneComponentResponsibilityOperational boundary
ControlPostgreSQL + Product Authorization / Keycloak IdentityTenant, Domain, policy, IAM, durable jobs and auditMail delivery does not depend on a live Control Plane for normal serving
OutboundKumoMTASMTP submission, queue/spool, routing, shaping and Internet deliveryNode-local spool; there is no shared spool
TransportHAProxyStable internal transport and selected HA endpointsThe proxy does not take over product ownership or queue semantics
Inbound ProtectionRspamd + ClamAVSpam/policy evaluation and malware scanningThe protection chain runs before backend/quarantine
DNS / Runtime StateUnbound + ValkeyProduct-controlled resolver path and shared runtime authority where neededResolver path and runtime state stay under product control
RuntimeLinux / VM Mail NodesKumoMTA, SMTP, sending IPs, DKIM and the queue data planeKubernetes is not a prerequisite for the Mail Data Plane
TECH

Control-plane Security Contract. Mail Gateway keeps Identity, Authorization and the Secret lifecycle separate from the Mail Data Plane, and binds high-risk mutations to a durable job and human approval.

DomainComponent / AuthorityTechnical contract
Control APIRust Control API + PostgreSQLTenant/Domain/Policy/Job/Audit state persists in the Product database.
IdentityKeycloakThe OIDC subject carries the user identity; browser or MCP credentials never stand in for the user identity.
AuthorizationOpenFGA + Product permission modelUnknown actions/routes fail closed, and permission is evaluated in resource scope.
SecretsOpenBaoSecret material and the recovery workflow are kept separate from ordinary configuration and UI state.
High-risk IAMDurable PostgreSQL JobRequest, human approval, execute-time reauthorization and authoritative post-check are separate steps.
MCPDelegated OIDC + scoped product toolsMCP can pass requests/diagnostics through product authority; it has no self-approval or generic Admin API.
ObservabilityPrometheus + Grafana + product probesQueue, TLS, routing and deliverability are shown from real telemetry; missing data is never presented as fabricated health.
05LIFECYCLE

Lifecycle

The mail lifecycle runs from onboarding to recovery.

Domain and node provisioning is only the start; Deliverability, Protection, Queue, Rotation and recovery are all core product operations.

01Pre-checkPreflight
02ProvisioningProvision
03Domain and identityAuthorize
04SendingDeliver
05Receiving and protectionProtect
06MonitoringObserve
07Upgrade and rollbackUpgrade / Rollback
08RecoveryRecover
06MAIL PROFILES

Operational profile

Every mail path has its own tools and policy.

Instead of a one-dimensional Mail Server, the product coordinates several specialized workflows under one Control Plane.

Outbound SenderDELIVERY

High-volume sending path with Queue and Routing.

  • Submission / HTTP injection
  • DKIM and Sender authorization
  • Routing / Shaping / Pools
Inbound ProtectRECEIVER

Public receiving with Authentication and Protection.

  • SPF / DKIM / DMARC / ARC
  • Anti-spam / Anti-malware
  • Backend delivery / Quarantine
DeliverabilityREPUTATION

Control over sending behavior and feedback.

  • Suppression
  • Warm-up / Safety policy
  • Bounce / FBL / OOB feedback
Tenant OperationsMULTI-TENANT

Domains, access and domain-scoped operations.

  • Tenant / Domain boundaries
  • Role-based actions
  • Audit / approval workflows
Mail Node LifecycleINFRASTRUCTURE

Nodes are manageable resources too.

  • Provisioning / Trust
  • Drain / Fence / Switchover
  • Health / recovery
Control Plane RecoveryRESILIENCE

Service management has its own Backup and recovery path as well.

  • Backup / Restore
  • PITR
  • Upgrade / rollback
07ACTION & WORKFLOW CONTRACT

Typed Action flow

AI agents, the browser and the API all go through the owner workflow; there is no generic mutation proxy.

For administrative operations, the Plan and the impact of a change are visible before execution, and high-risk approval is kept separate from execution.

01DiscoverLIST ACTIONS
02PlanCREATE PLAN
03ImpactPRECONDITIONS
04ApproveHUMAN APPROVAL
05ExecuteDURABLE JOB
06VerifyPOST-CHECK
OUTBOUND FEEDBACK LOOP

Queue → Delivery → Feedback

Delivery is not the final outcome; bounces and telemetry feed back into policy.

SUBMISSION
→
QUEUE /
SPOOL
↓
POLICY
LOOP
↑
INTERNET
DELIVERY
←
BOUNCE /
TELEMETRY
routing · shaping · DKIM · delivery feedback
Node-local spool is not lost when the Control Plane goes down.
INBOUND BRANCH

Deliver / Quarantine / Reject

Inbound mail reaches an explicit outcome after auth and content gates.

SMTP RECEIVE
↓
SPF · DKIM · DMARC
↓
RSPAMD + CLAMAV
↓
DELIVER
QUARANTINE
REJECT
A protection failure is never bypassed; it goes to a policy-defined outcome.
APPROVAL GATE

High-risk IAM with Human Approval

Plan, Approval and execute-time reauthorization are kept separate.

PLAN + IMPACT
↓
HUMAN
APPROVAL
↓
REAUTHORIZE
↓
KEYCLOAK WRITE
authoritative post-check closes the durable job
MCP or an agent is not allowed to self-approve or perform generic admin mutations.
ADDITIONAL OPERATIONAL FLOWS

Additional operational flows

Queue incidents and Routing/Shaping are independent, high-risk Day‑2 changes.

Action / FlowAdmission / PreconditionsExecution / LockSuccess CriterionFailure / Recovery
Domain OnboardingValid Tenant/Domain ownership, authorization and policy inputTyped owner action; config/runtime mutation goes through the Control APIDomain/DKIM/routing readiness from Product state and runtime read-backValidation failure before activation; partial state is tracked through workflow recovery
DKIM RotationDomain scope, signer identity and rotation preconditionsDurable mutation with audit and bounded secret handlingActive key/signing state and DNS-facing readiness are verifiedOld/new key overlap and rollback are owner-specific; secret material is never shown in MCP/UI
Queue / Delivery ActionExact tenant/queue/message scope and permissionTyped queue action; there is no shell/raw SQL/direct Kumo admin proxyQueue/history post-check shows the result of that same actionAn unknown outcome requires read-back; replay follows the owner’s idempotency semantics
Routing / Shaping / SuppressionProvider/domain/resource scope + risk/permission contractRegistry-backed action with Product policy authorityEffective route/pool/suppression state is read back after the mutationUnknown action fails closed; historical risk downgrade is not allowed
IAM User LifecycleDelegated OIDC subject and Product authorization; high-risk impact previewRequest → independent human approval → execute-time reauthorization → Keycloak WriterAuthoritative Keycloak post-check confirms enabled/session/group stateMCP has no approve/execute bypass; stale/revoked authorization is rejected again at execute time
Mail Node LifecyclePinned target/release identity, preflight and runtime readinessProvision/Drain/Fence/Switchover tied to durable lifecycle/evidenceNode role, queue/spool and service health are verified from runtimeNode-local spool is assumed; a switchover failure is never hidden behind an assumed shared spool or fabricated success
FLOW

The Management MCP lifecycle is explicitly list actions → create plan → inspect impact/preconditions → human approval → execute → post-check. An agent cannot approve its own proposal and has no general-purpose shell, raw SQL, filesystem or secret-export tool.

08OPERATIONS CATALOG

Operations catalog

From Domain to Queue and recovery, operations in one Workbench.

Operators should be able to see sending and receiving status and take the necessary action without switching between separate tools.

Domain OnboardingDomain registration, identity verification and sending/receiving Policy.
DKIM LifecycleCreation, activation and Rotation of the domain signing identity.
Queue OperationsVisibility and actions on the Queue and History.
Routing & ShapingRoute, Pool and limit selection matched to each Provider.
QuarantineReview, Release, Delete and Expiry of held messages.
SuppressionManagement of invalid or high-risk recipients and Feedback.
Node LifecycleProvisioning, Drain, Fence and Switchover of Mail Nodes.
Backup / RecoveryProtection and recovery of the Control Plane and operational state.

Run email as a critical data plane.

4SO Mail Gateway brings sending, receiving and operations together in one self-hosted, traceable product.

All 4SO products →