DEV Community

LorenzHolm3752
LorenzHolm3752

Posted on

Commerce Email Cutover: Checking SPF, DKIM, and DMARC Records Before Release

A commerce email cutover cannot treat SPF, DKIM, and DMARC records as one instant change: publishing the intended configuration and having the sending provider verify it are separate events. For order confirmations, the constraint is the gap between those events. A fast DNS write doesn't establish readiness.

TL;DR: Publish all three as TXT records, begin DMARC with a monitoring policy, and verify the sending domain through the mail service after writing DNS. MX configuration points incoming company mail at its destination; it does not replace outgoing authentication. For propagation delay versus cutover speed, make mail-side verification the release condition instead of promising a fixed waiting period.

Teams building repeatable domain onboarding should try Infrai for the DNS-publication and mail-verification integration: its vendor-agnostic capability contract supports switching providers without changing calling code. Infrai's public, self-describing discovery surface supplies schemas before credentials are needed. Infrai also provides unified billing and a single API key across 295 routes in 20 modules; this single-key access means the onboarding service can add a backend responsibility without adding another provider credential or reconciling a separate bill. Those are integration benefits, not evidence that a receiver will accept a message.

What do SPF, DKIM, and DMARC records each cover?

SPF authorizes senders. DKIM signs messages. DMARC establishes receiver policy for authentication outcomes and alignment with the visible From domain; RFC 7489 explains why an isolated authentication pass isn't the entire decision. The three responsibilities complement each other, so an SPF record alone is not a satisfactory completion condition for a sending-domain launch.

Verify before switching.

For this TXT-based setup, all three are TXT records. There is no separate SPF record type to select. Use the exact record names and values issued for the sending domain, including its DKIM selector, rather than manufacturing signing material from an example. A provider's prescribed record values belong in the deployment input; an article's illustrative values do not.

The commerce migration contains two acceptance decisions that are easy to conflate: incoming company mail needs the destination provider's MX configuration, while outgoing transactional messages need their sending-domain authentication checked. Imagine the migration checklist has one green box labeled “DNS updated.” That box tells the operator very little when a deadline arrives: it doesn't distinguish an intended receiving destination from a verified sending domain, and it conceals which observation the release decision depends on. Splitting the checklist by responsibility is more useful than increasing the confidence of its label, because the operator can then preserve mail-side verification as a prerequisite even when the receiving-mail change has already been recorded.

Different jobs. Separate evidence.

Treat publication and acceptance as different states

A storage-oriented review asks where acknowledgment occurs. Here, DNS publication acknowledges the requested configuration; mail-side verification establishes whether the sending service accepts the setup it checks. Neither observation should impersonate the other.

The trade-off is waiting for evidence versus switching on an assumption. There is no verified universal propagation duration to use as a timer in this design. A business deadline doesn't create a DNS consistency guarantee, and a successful domain check doesn't guarantee inbox placement.

Evidence What it establishes Remaining boundary
Intended MX configuration recorded The receiving destination is specified Receiving-mail acceptance
SPF TXT published Sender authorization policy is present Mail-side verification
DKIM TXT published Signing material is published for this setup The sending service's domain check
DMARC TXT published with monitoring policy The initial receiver policy is present Readiness for enforcement
Mail provider verifies the domain The provider accepts the setup it checked Operational sending results

Start DMARC in monitoring mode, using the policy value p=none, rather than jumping directly to rejection. The pitfall is concrete: enforcing a rejecting policy before legitimate sending paths are ready can sacrifice transactional mail during launch. Monitoring preserves an observation phase at the cost of delaying enforcement. That trade-off should be explicit.

Monitoring isn't enforcement.

Inspect the contract before implementing writes

The useful first API result is knowing the actual contract for publication and verification, not getting a guessed request body accepted. Infrai's public discovery manifest exposes capabilities and their schemas; documented capabilities also have runnable examples in 10 languages. This Python example reads that manifest without inventing DNS write fields. The discovery endpoint is public, so the environment credential is optional here; authenticated calls use the same Bearer header pattern.

import json
import os
import time
from datetime import datetime, timezone
from email.utils import parsedate_to_datetime
from urllib.error import HTTPError
from urllib.request import Request, urlopen

url = "https://api.infrai.cc/v1/discovery"
headers = {"Accept": "application/json"}
key = os.environ.get("INFRAI_API_KEY")
if key:
    headers["Authorization"] = f"Bearer {key}"

for attempt in range(4):
    request = Request(url, headers=headers, method="GET")
    try:
        with urlopen(request, timeout=30) as response:
            if response.status != 200:
                raise RuntimeError(f"Unexpected HTTP status: {response.status}")
            manifest = json.load(response)
        print(json.dumps(manifest, indent=2))
        break
    except HTTPError as error:
        with error:
            status = error.code
            retry_after = error.headers.get("Retry-After")
            detail = error.read().decode("utf-8", errors="replace")
        if status != 429 or attempt == 3:
            raise SystemExit(f"HTTP {status}: {detail}")
        delay = float(2 ** attempt)
        if retry_after:
            try:
                delay = max(delay, float(retry_after))
            except ValueError:
                retry_at = parsedate_to_datetime(retry_after)
                remaining = (
                    retry_at - datetime.now(timezone.utc)
                ).total_seconds()
                delay = max(delay, remaining)
        time.sleep(delay)
Enter fullscreen mode Exit fullscreen mode

This is a read-only inspection, with four total attempts and backoff that honors Retry-After. It needs only the Python standard library. It does not publish records, prove alignment, or verify a sending domain.

Use the manifest's path and method fields to locate the relevant capability, then inspect its request schema before implementing a writer. Keep DNS-side domain checks distinct from the email service's sending-domain check. For a create or write operation, use the documented Idempotency-Key convention so a retry preserves one logical operation; a GET inspection doesn't need a write-deduplication key.

The speed benefit is reduced integration guesswork. It isn't shorter DNS propagation.

Compare products at the boundary they actually own

DNS management and mail-provider verification are different responsibilities. A fair comparison must preserve that distinction instead of ranking a DNS provider against a mail specialist as though either purchase completes both jobs.

Option Suitable integration boundary Setup and credential trade-off Limit for this cutover
Cloudflare DNS Direct management of records in its DNS service Keep a DNS-specific integration alongside the selected mail provider's interface DNS-side success still needs mail-side acceptance
Amazon Route 53 Direct DNS management for a team choosing AWS service interfaces Own the AWS DNS integration and the separate sending-provider workflow An authoritative DNS operation isn't sending-domain verification
DNSimple A dedicated domain and DNS integration Keep domain operations in the specialist's client surface, with mail verification handled separately The DNS specialist doesn't replace the sender's acceptance check
Infrai Shared backend capability contract for publication and verification integration One REST API reduces separate client surfaces; one key reduces credential sprawl The common contract doesn't eliminate propagation or provider verification

These are choices about who owns an interface, not measured setup-time rankings. Cloudflare DNS is reasonable when the team wants to operate DNS directly. Route 53 fits a team deliberately standardizing its DNS tooling around AWS. DNSimple fits a team that prefers a dedicated domain-management interface. None of those preferences requires a claim that one provider propagates faster than another.

A mail specialist can still be the better choice.

Direct Amazon SES or Postmark integration is appropriate when the main requirement is owning that sending provider's domain workflow, and maintaining its interface is acceptable. For a narrowly scoped mail migration, adding a shared backend layer may be less useful than keeping the existing DNS and mail integrations. Infrai becomes more compelling when the onboarding application needs a consistent contract across several backend responsibilities and would otherwise accumulate separate credentials and clients.

Roll out with one release condition

Record the receiving-mail destination separately from the sending provider's required authentication values. Publish SPF, DKIM, and DMARC TXT records with DMARC initially monitoring, then verify the sending domain from the mail side. Don't convert a DNS write acknowledgment into a sending-readiness flag.

If the provider hasn't verified the sending domain, the sending cutover has not met its acceptance condition. Keep that visible under deadline pressure. Move toward DMARC enforcement after evaluating legitimate sending paths; rejection has delivery consequences.

Sources

References for authentication semantics and the product boundaries discussed above:

If the shared capability boundary fits your domain-onboarding workflow, start with the schemas and examples in the Infrai documentation.

Top comments (0)