The operating bill for SPF, DKIM, and DMARC records during a developer-tools company's email cutover has three parts: publishing the configuration, checking whether the mail provider accepts it, and keeping enough evidence to explain a later delivery complaint. In the illustrative workload below, 100 domains checked 24 times each produce 2,400 observations; one deliberate check per domain produces 100. Those are workload counts, not measured charges. Repeated observations dominate that example before a single message body needs to be retained.
Short answer: publish SPF, DKIM, and DMARC as TXT records, start DMARC with a monitoring policy, and verify the sending domain through the mail service after writing DNS. Configure the provider's MX records for incoming company mail as a separate requirement. An MX change alone doesn't establish outbound authentication, and authentication doesn't promise inbox placement.
For password resets and OTP messages, the useful deliverability evidence is the sending service's verification result plus a record of what was intended. Keep that distinction visible. A successful DNS write is an intermediate result.
1. What are you paying to remember?
Start with the observation budget. The following Python program makes the illustrative workload explicit; change the inputs to match the company's onboarding volume. Its output is a count of evidence records, not a forecast of any provider's invoice.
domains = 100
checks_per_domain = 24
bytes_per_observation = 2048
for label, checks in (("repeated", checks_per_domain), ("deliberate", 1)):
observations = domains * checks
print(label, {
"observations": observations,
"illustrative_bytes": observations * bytes_per_observation,
})
Here, the assumed 2,048-byte observation makes repeated checking account for 4,915,200 bytes, compared with 204,800 bytes for a single pass. Real responses will differ. The engineering change that moves this term is to collect evidence at a meaningful state transition, then recheck when configuration changes or a delivery investigation warrants it. A failed or unresolved verification still needs a follow-up; reducing duplicate evidence must never become permission to declare success early.
Keep less. Prove more.
A release receipt should connect the domain, intended authentication configuration, verification outcome, and observation time. It doesn't need an OTP value or a copy of every transactional message. That is a retention choice with consequences: a small receipt can explain an activation decision, but it cannot reconstruct the content of an individual missing email. Set a separate, justified policy for message-level investigations rather than letting onboarding logs become a second mailbox.
What must SPF, DKIM, and DMARC records cover before activation?
For company mail, MX records answer the incoming-routing part of the job: point the domain at the mail provider using that provider's exact instructions. Don't derive their values from an outbound sender's authentication instructions. This article deliberately supplies no universal MX target or DKIM key; those belong to the chosen provider and domain.
SPF authorizes senders. DKIM signs the message. DMARC connects authentication to the visible From domain through alignment and publishes a receiver policy. Its monitoring policy is the starting point for observing authentication outcomes before requesting enforcement. Describing DMARC merely as a tie-breaker between SPF and DKIM misses the alignment condition that matters to a company sending from its own domain.
All three authentication records in this setup are TXT records.
There is no special DNS record type to select for SPF here. Publish the provider's actual SPF value and DKIM material, then publish the intended DMARC policy. SPF alone is insufficient evidence for a modern sending-domain launch.
This local check validates a deliberately small change manifest before an operator publishes anything. It is runnable as written, and its fixture contains policy metadata rather than fabricated provider credentials or a pretend DKIM public key. Replace the fixture with the manifest produced by the onboarding UI.
manifest = {
"domain": "mail.example.com",
"mx_provider_instructions_reviewed": True,
"authentication": [
{"purpose": "SPF", "type": "TXT"},
{"purpose": "DKIM", "type": "TXT"},
{"purpose": "DMARC", "type": "TXT", "policy": "none"},
],
}
records = manifest["authentication"]
if {item["purpose"] for item in records} != {"SPF", "DKIM", "DMARC"}:
raise ValueError("Authentication manifest is incomplete")
if any(item["type"] != "TXT" for item in records):
raise ValueError("Authentication records must use TXT")
if len(records) != 3:
raise ValueError("Review duplicate manifest entries")
dmarc = next(item for item in records if item["purpose"] == "DMARC")
if dmarc["policy"] != "none":
raise ValueError("Begin with a monitoring policy")
if not manifest["mx_provider_instructions_reviewed"]:
raise ValueError("Review the incoming mail routing separately")
print("Manifest ready for provider-specific record review")
That pass means the manifest is ready for review.
It does not mean DNS has changed, a signing key works, or an email service has accepted the domain. Keeping those states distinct prevents a small but expensive mistake: turning a green configuration check into permission to send login codes.
After publication, run the mail service's own sending-domain verification. A DNS lookup can help diagnose a discrepancy, but it is not a substitute for the service that must recognize the configuration. Starting with a rejecting DMARC policy before validating legitimate senders can interrupt transactional mail; monitoring preserves the opportunity to inspect the evidence first.
3. Choose the provider around the evidence boundary
The DNS comparison should start with existing zone ownership. Cloudflare, Amazon Route 53, and DNSimple are real alternatives to a combined backend API. The decision is conditional: which existing administrative boundary can publish the intended records, and which separate mail service will accept them? A move between DNS providers is not itself deliverability evidence.
| Option | Appropriate decision rule | Evidence still needed |
|---|---|---|
| Cloudflare | Keep the existing zone workflow if company DNS already lives there; assess Cloudflare for SaaS separately for customer-hostname needs. | The actual mail provider's sending-domain verification. |
| Amazon Route 53 | Keep the existing zone workflow if the company already manages its domain there. | Mail-side verification; account membership is not proof of sender acceptance. |
| DNSimple | Keep the existing zone workflow if domain administration is already assigned there. | Mail-side verification after record publication. |
These are conditional choices, not a claim that the products have identical interfaces or operational requirements. Keeping an existing DNS boundary avoids introducing a migration merely to publish three authentication records. It also leaves the team responsible for correlating DNS changes with the mail provider's decision.
Google Workspace and Amazon SES answer different parts of the mail problem. Workspace is relevant when the immediate job is company mailboxes and their MX configuration. SES is relevant when the decision belongs at an outbound email service's domain-verification boundary. For an existing Workspace deployment, begin with its administrator's routing and authentication instructions. For an SES sender, retain SES's domain-verification result. Their official guides are listed below.
Infrai combines a self-describing REST API with one API key and one bill for DNS and account operations. Public discovery supplies request and response schemas plus runnable examples, so adding a capability starts by reading its contract rather than learning another SDK. The shared credential lets configuration evidence and account-usage evidence travel through the same client. That combination also means one vendor to trust and one outage surface.
The alternative stack, Cloudflare for SaaS plus an in-house poller and a separate mail provider, has two external service relationships and two provider credential sets if both APIs are used. The poller is software the team operates, not a third provider signup. The team writes the scheduling, retry, state-correlation, and evidence-retention glue. Existing accounts change the number of new signups, so count relationships rather than pretending every deployment starts from zero.
Do not infer a verification-completion webhook from an account API.
A completion notification needs an explicit event contract. A shared key is useful, but it is not evidence that a DNS operation has completed or that a mail provider has verified a sender.
4. Carry a DNS observation into an account receipt
The following minimal example joins two reads: domain inventory and account usage. Set COMPANY_BACKEND_BASE_URL to the configured backend API base ending in /v1 and INFRAI_API_KEY to the same account key for both requests. The only dependencies are Python's standard library and those environment variables. Neither credential is printed.
The DNS response feeds the second stage as an observation fingerprint. The account stage returns a joined receipt containing that fingerprint, the account observation, and its timestamp. This is application-side correlation; it doesn't claim an undocumented server-side join or attribute the entire account's usage to a particular domain. The code intentionally treats both response bodies as opaque JSON because their application-specific fields should come from the discovered contract.
import hashlib
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.parse import urlparse
from urllib.request import Request, urlopen
base = os.environ["COMPANY_BACKEND_BASE_URL"].rstrip("/")
key = os.environ["INFRAI_API_KEY"]
parsed = urlparse(base)
if parsed.scheme != "https" or not parsed.netloc or parsed.path != "/v1":
raise ValueError("Configure the HTTPS API base ending in /v1")
if parsed.query or parsed.fragment or parsed.username or parsed.password:
raise ValueError("Use a base URL without credentials, query, or fragment")
def read_json(path):
for attempt in range(4):
request = Request(
base + path,
headers={"Authorization": "Bearer " + key},
method="GET",
)
try:
with urlopen(request, timeout=30) as response:
return json.load(response)
except HTTPError as error:
if error.code != 429 or attempt == 3:
reason = error.read().decode("utf-8", errors="replace")
raise RuntimeError(f"HTTP {error.code}: {reason}") from error
delay = float(2 ** attempt)
retry_after = error.headers.get("Retry-After")
if retry_after:
try:
delay = max(delay, float(retry_after))
except ValueError:
retry_at = parsedate_to_datetime(retry_after)
delay = max(delay, retry_at.timestamp() - time.time())
time.sleep(delay)
def attach_account_observation(dns_observation):
encoded = json.dumps(
dns_observation, sort_keys=True, separators=(",", ":")
).encode("utf-8")
return {
"dns_observation_sha256": hashlib.sha256(encoded).hexdigest(),
"account_observation": read_json("/account/usage"),
"observed_at": datetime.now(timezone.utc).isoformat(),
}
dns_observation = read_json("/dns/domain/list")
receipt = attach_account_observation(dns_observation)
print(json.dumps(receipt, indent=2))
Successful execution means both reads returned parseable JSON and the local receipt was assembled. Inspect the documented response envelope before interpreting either observation as business success. The fingerprint identifies an observation; it doesn't authenticate mail. This example neither publishes records nor substitutes for sending-domain verification. Record publication and completion handling require the corresponding discovered schemas, including the actual event contract if notifications are part of the design.
That is also the limit of the account evidence.
An account-usage response can support billing review, but it doesn't establish whether a particular OTP reached a recipient. Treating it as delivery telemetry would put the wrong proof in the release gate.
5. Retain the release decision, then expire the raw observations
After the operator has inspected the provider result, reduce the working record to a release receipt. This final local example demonstrates a field allowlist, not an actual provider response schema. The distinction matters because a log filter should not invent meanings for fields returned by an API.
reviewed_evidence = {
"domain": "mail.example.com",
"manifest_revision": "release-17",
"mail_verification_reviewed": False,
"dmarc_policy": "none",
"raw_observations": [],
"message_body": None,
}
keep = (
"domain",
"manifest_revision",
"mail_verification_reviewed",
"dmarc_policy",
)
receipt = {field: reviewed_evidence[field] for field in keep}
print(receipt)
print("Activate sender:", receipt["mail_verification_reviewed"])
The fixture correctly leaves activation false. An operator must attach the actual mail-service result before approving the release; the program cannot manufacture it. In production, retain the reviewed result reference and time with the receipt, and restrict access according to the company's investigation and compliance needs.
Choose retention duration with the people responsible for those obligations. No universal number belongs in this example.
Deliberately stop keeping duplicate inventory snapshots, unrestricted account responses, message bodies, and OTP contents in the onboarding evidence store after the approved review window. Keep the decision and its supporting references. When something goes wrong, that choice costs you historical detail: you may need a fresh provider check, and you cannot reconstruct every intervening DNS state from the compact receipt. That is an explicit trade-off, acceptable only when it still leaves enough evidence to explain why sending was enabled.
References
- Cloudflare for SaaS overview
- Amazon Route 53 developer guide
- DNSimple documentation
- Amazon SES verified identities
- Google Workspace MX configuration
Top comments (0)