For a fintech platform that automatically gives every tenant a subdomain, choose the visible sender domain and its DNS owner before activating outbound mail; then verify that a passing authentication result aligns with that sender. Publishing three records is not an acceptance test. RFC 7489 defines DMARC around authenticated identifiers and their relationship to the visible From domain, which makes zone ownership an operational dependency rather than a provisioning detail.
TL;DR: SPF authenticates the envelope sender domain; DKIM authenticates a signing domain in the signature's d= value. DMARC compares those authenticated domains with the domain in the message's RFC5322.From field. One passing, aligned path is sufficient. Both can pass authentication while neither aligns, and a DMARC pass still does not promise inbox placement.
Keep activation gated.
The useful incident question is therefore narrower than “did the DNS setup finish?”: which authenticated identity did this receiver evaluate, did it align under the applicable policy, and who can change that identity or its DNS records? For automated tenant onboarding, make the answer part of the activation evidence. Otherwise a completed DNS job can conceal an unfinished mail configuration.
Why is mail going to spam after SPF and DKIM setup?
Start with one received message, including its original headers, and identify the visible From domain before inspecting any DNS record. In RFC 7489's terminology, this is the Author Domain. An SPF TXT record does not align on its own, and neither does a DKIM public key: alignment describes the relationship between domains associated with the message, after authentication succeeds. This distinction matters because a DNS control plane can truthfully report that a record exists while the receiver evaluates an entirely different sending identity.
Consider a hypothetical tenant called Ledger, assigned ledger.platform.example. A notification has the visible address alerts@ledger.platform.example, an envelope sender under bounce.delivery.example, and a passing DKIM signature whose d= is delivery.example. Even if SPF passes for the envelope sender, neither authenticated domain aligns with the visible From domain. The relevant domains belong to different organizational domains. Adding another copy of the visible domain's SPF record would not change which envelope identity the receiver authenticated.
That is the trap.
Change the example so a valid DKIM signature uses d=ledger.platform.example. Its domain now exactly matches the visible From domain, satisfying strict DKIM alignment as well as relaxed alignment, so that signature can supply the aligned authentication DMARC needs even if the SPF identity remains unrelated. Conversely, a passing SPF result can satisfy DMARC when its authenticated envelope domain aligns, even if no DKIM signature supplies an aligned pass. Do not require both paths to succeed as the definition of DMARC success. RFC 7489 distinguishes strict alignment, which requires an exact domain match, from relaxed alignment, which permits a shared Organizational Domain; the default alignment mode is relaxed. The policy's adkim and aspf values govern the two paths separately. Organizational Domain discovery depends on public suffix information, so “take the last two labels” is an unsafe implementation shortcut. For this runbook, use exact matches in activation examples to keep the required relationship explicit; do not mistake that choice for the standard's default.
Use authentication results from the receiving system's trusted evaluation boundary. RFC 7489 discusses consuming Authentication-Results and its associated trust considerations; a result copied from an arbitrary header is not sufficient evidence for an activation decision. Preserve the evaluated identities and results together, since a bare “SPF pass” loses the domain needed to interpret it.
Put zone ownership into the activation contract
The decisive split is between a platform-owned zone, where provisioning can establish the tenant's sender configuration under platform control, and a customer-owned zone, where activation depends on a separate administrator completing and retaining the required DNS changes. A tenant may receive a platform subdomain automatically while asking to send from alerts@ledger.example; those are two different deliverables. Marking the subdomain allocation complete should not activate the customer-owned sender.
This is an ownership and change-control problem. Treat the following table as a proposed operating model, with the trade-offs made explicit rather than a claim that outsourcing DNS transfers responsibility for mail identity.
| Provisioning choice | Who can complete the change? | Buy versus build trade-off | Activation evidence |
|---|---|---|---|
| Platform-owned zone with managed DNS | Platform automation, within its granted authority | Buy DNS operation; build sender intent, reconciliation, and the activation gate | Received message has a passing, aligned identity for the assigned From domain |
| Platform-owned zone with self-operated DNS | Platform DNS and mail owners | Build and operate authoritative DNS as well as the tenant workflow; include both in on-call planning | Same message evidence, plus an accountable DNS change owner |
| Customer-owned zone | Customer administrator, unless authority has been delegated | Buy or build the workflow, but retain the external approval dependency | Customer changes are visible and a received message demonstrates the intended alignment |
The third row is where a provisioning SLO needs care. Define platform-controlled processing time separately from time awaiting a customer DNS change, and retain an end-to-end activation measure so the dependency does not disappear from reporting. A recommendation for the control plane is to keep states such as pending ownership, pending verification, and active distinct, with a recorded owner for each transition. These are proposed workflow states, not DNS protocol states.
Plan capacity around pending work as well as active tenants. Before setting concurrency, count how many unresolved activations can be reconciled, how retries are bounded, and who receives an alert when the queue stops progressing; no traffic rate or retry interval can be inferred from the authentication standard. Unbounded polling of customer-owned zones is an operational choice, not a requirement of DMARC. Prefer an explicit retry budget and an operator-visible backlog to silently accumulating work.
Implement the smallest safe alignment check
Capture the receiver's SPF result and authenticated envelope domain, the DKIM result and signing domain for each signature, the visible From domain, and the applicable DMARC alignment modes. Inspect the SPF configuration for the envelope domain actually used. For DKIM, inspect the selector and signing domain in the message, then the corresponding public-key record under that signing domain. Inspect DMARC policy discovery for the visible From domain, including the Organizational Domain fallback described in RFC 7489, rather than assuming a record on an unrelated delivery domain governs the message.
The following Go function illustrates only the exact-match decision for a deliberately strict policy. Its inputs must already contain validated, lowercase ASCII domain names and trusted authentication results. It does not parse headers, discover policy, verify a signature, evaluate SPF, or implement relaxed alignment; production activation should consume a complete evaluator's result rather than presenting this small function as a DMARC implementation.
package alignment
type DKIMResult struct {
Domain string
Pass bool
}
func StrictAlignedPass(from, envelope string, spfPass bool, signatures []DKIMResult) bool {
if from == "" {
return false
}
if spfPass && envelope == from {
return true
}
for _, signature := range signatures {
if signature.Pass && signature.Domain == from {
return true
}
}
return false
}
The loop matters.
A message can carry multiple DKIM signatures, and an unrelated signature's success must not obscure a different signature that supplies the aligned pass. Equally, matching domain text cannot rescue a failed signature. Authentication and alignment are separate conditions joined by an AND within each path, followed by an OR between the SPF and DKIM paths.
For the Ledger example, strict verification should reject a passing delivery.example signature against From domain ledger.platform.example, accept a passing signature with d=ledger.platform.example, and reject a failed signature even when that domain matches. Add a case with two signatures, one unrelated and one aligned, to catch code that checks only the first result. Test relaxed policies separately with a standards-aware evaluator; reusing this exact-match function would incorrectly reject some relationships that relaxed alignment permits.
Keep the sender contract next to the provisioning request: tenant identifier, intended From domain, zone owner, allowed sending configuration, and verification status. A deployment that changes the envelope identity or DKIM signing domain should trigger renewed verification. The DNS record can remain untouched while the message identity changes underneath it.
Verify delivery evidence before widening activation
Send a controlled notification using the actual tenant sending configuration, inspect the received message, and preserve enough evidence to reproduce the decision: visible From domain, authenticated SPF domain, DKIM signing domains and outcomes, evaluated policy modes, and DMARC result. Separate authentication evidence from the receiver's final placement. RFC 7489 allows receiver discretion in disposition, so “DMARC pass, spam placement” is not a contradiction and does not justify changing a record without identifying a failed relationship.
Stop guessing.
If DMARC fails, work backward from the failed path: an unrelated passing SPF domain calls for examining the envelope configuration; an unrelated passing DKIM domain calls for examining the signer configuration; a failed authentication result calls for resolving that authentication failure before treating domain equality as success. If DMARC passes, retain the proof and examine receiver-specific delivery evidence. The standard does not supply a universal diagnosis for every spam-folder decision.
For rollout, gate a limited set of tenant activations on message-level verification before allowing the wider queue to advance. Measure the proposed activation SLO using eligible requests and successful verification, and track pending customer changes separately. Track authentication failures and alignment failures as distinct diagnostic outcomes, because they send the operator toward different changes; keep individual tenant detail in bounded investigative records so observability capacity grows deliberately with the tenant population.
Roll back the sender change with its DNS dependency
Before changing a production sender, retain the last verified configuration and identify who can restore it. In a platform-owned zone, the rollback owner can coordinate sender configuration and DNS; in a customer-owned zone, restoring DNS may require the customer's administrator, which makes a rollback plan that assumes immediate platform control incomplete. Pause new activations affected by the change while that dependency is unresolved.
Do not use a weaker DMARC policy as proof that a sender is fixed. Policy requests and identifier alignment answer different questions, and RFC 7489's monitoring policy does not turn an unaligned message into an aligned one. Restore the verified sending identity where feasible, preserve the records that configuration needs, and verify a newly received message before resuming activation; a DNS edit alone is insufficient closure evidence.
The completion rule is concrete: the tenant's intended visible sender has a trusted, passing, aligned authentication path, its DNS changes have an accountable owner, and the activation gate retains the evidence. Inbox placement remains a separate observed outcome. That boundary makes the runbook useful when the next tenant brings a customer-owned zone instead of accepting the platform subdomain.
References
- RFC 7489, Domain-based Message Authentication, Reporting, and Conformance (DMARC), especially Sections 3.1, 6.3, 6.6, and 9: https://datatracker.ietf.org/doc/html/rfc7489
Top comments (0)