A logistics admin console can show a successful key change while the sending domain still publishes the wrong DNS TXT record. For dispatch notices and delivery updates, that gap is the constraint that should determine the design: the operator needs evidence that the mail service and DNS agree, rather than a green badge for one completed request.
Short answer: schedule DKIM key rotation, publish the corresponding DNS TXT record in the same job, and verify the sending domain afterward. Waiting for an incident leaves a routine maintenance task dependent on urgency; scheduling only the key change leaves half the work unfinished. Choose an integration that lets the console preserve evidence across both operations.
Verification comes before closure.
What evidence should a DKIM key rotation schedule produce?
Treat this as an evidence problem. A new key at the mail service and a published record in DNS are two separate outcomes, and a successful response from either side establishes only that side of the change. The admin console should therefore distinguish a requested rotation, a completed publication, and a verified sending domain; combining them into one success state makes it harder to tell an operator what actually happened.
For a proposed logistics workflow, consider dispatch.example.com, a domain used for shipment notifications. The console can retain the intended domain, the rotation job identifier, the DNS publication result, and the subsequent verification result as one maintenance record. Those are application design choices, not promises about a provider's response fields. Preserve the evidence each service actually returns, with enough context to connect it to the same job.
There are 2 halves to the change. Neither substitutes for the other.
This distinction matters to a storage architect because a write acknowledgment and an application invariant answer different questions: accepting a change does not establish that every dependent reader can use it. Here, the invariant is that the sending-domain configuration and its published authentication record agree. A combined API can make that invariant easier to enforce, but a shared credential does not itself make separate operations atomic.
Domain verification is also a narrower claim than inbox delivery. The DMARC specification describes authentication and policy evaluation; it does not turn a successful maintenance check into proof that a recipient received a dispatch notice. Keep the console's labels precise: “domain verified after rotation” is useful evidence, while “deliverability guaranteed” promises an outcome the check cannot establish.
Derive the job from the invariant
The scheduled job should obtain the new signing configuration, publish the corresponding TXT record, and then verify the sending domain. Keep the sequence together so that DNS publication is a required part of rotation rather than a separate ticket someone must remember to finish. The case for scheduling does not need an alarming threat story: the ordinary risk receives little attention, which is exactly how maintenance slips indefinitely.
The interval is a policy decision. No universal number follows from this workflow.
Choose that policy with the mail service's documented behavior and the organization's operational requirements in view, then record it in the console alongside the next planned run. A job that cannot establish its post-change verification result should remain incomplete in the application, with the available evidence attached for an operator to inspect. Do not silently translate “request accepted” into “maintenance finished.”
Three failure modes deserve explicit names: split completion, where the key changes without the matching publication; false closure, where the console reports success before verification; and unsupported delivery inference, where authentication evidence is presented as recipient delivery evidence. These are workflow hazards, and the console should make their states distinguishable rather than burying them in a generic success flag.
Retries require the same discipline. A read can be repeated after a rate-limit response; a write needs the documented idempotency behavior for that particular operation, because repeating a rotation indiscriminately can change the intended state again. Retain the job identity across attempts. Also avoid treating an upsert as proof of the whole workflow: its role is to publish the record, after which sending-domain verification still has work to do.
A small handoff the console can actually inspect
Before enabling scheduled writes, exercise the boundary with reads. The following Python program lists DNS domains, requires the configured domain to appear as an exact string in the returned JSON, and passes that returned value into a mail-domain lookup. Both requests use the same key and base URL. It demonstrates the credential and data handoff without guessing the response fields for key rotation or TXT publication.
Set INFRAI_API_KEY, INFRAI_BASE_URL to the service's documented v1 base, and SENDING_DOMAIN in the environment. The base must include its version prefix. This example uses the Python standard library and makes no configuration changes.
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 quote
from urllib.request import Request, urlopen
BASE = os.environ["INFRAI_BASE_URL"].rstrip("/")
KEY = os.environ["INFRAI_API_KEY"]
DOMAIN = os.environ["SENDING_DOMAIN"]
def retry_delay(value, attempt):
if value:
try:
return max(0.0, float(value))
except ValueError:
try:
when = parsedate_to_datetime(value)
return max(0.0, (when - datetime.now(timezone.utc)).total_seconds())
except (ValueError, TypeError, OverflowError):
pass
return float(2 ** attempt)
def get_json(path):
for attempt in range(5):
request = Request(
BASE + path,
headers={"Authorization": "Bearer " + KEY},
method="GET",
)
try:
with urlopen(request, timeout=30) as response:
if response.status != 200:
raise RuntimeError("Unexpected status: " + str(response.status))
return json.load(response)
except HTTPError as error:
detail = error.read().decode("utf-8", errors="replace")
if error.code != 429 or attempt == 4:
raise RuntimeError(f"HTTP {error.code}: {detail}") from error
time.sleep(retry_delay(error.headers.get("Retry-After"), attempt))
def strings(value):
if isinstance(value, str):
yield value
elif isinstance(value, list):
for item in value:
yield from strings(item)
elif isinstance(value, dict):
for item in value.values():
yield from strings(item)
dns_result = get_json("/dns/domain/list")
published_domain = next(
(value for value in strings(dns_result) if value == DOMAIN), None
)
if published_domain is None:
raise RuntimeError("Domain absent from this DNS response; inspect before proceeding")
mail_result = get_json("/email/domain/get/" + quote(published_domain, safe=""))
print(json.dumps({"domain": published_domain, "mail_lookup": mail_result}, indent=2))
This is deliberately a preflight check. Finding a domain string in a DNS response does not validate a DKIM TXT value, and a mail-domain lookup does not replace the post-rotation verification operation. If the exact domain is absent from this response, the program stops; inspect the documented list behavior and domain configuration before using the result to authorize maintenance. It does not conclude that the domain cannot exist elsewhere.
The production write job needs the documented request and response schemas for rotation, record publication, and verification. Use those schemas to connect the returned signing configuration to the DNS write, and retain the verification result before closing the job. Avoid manufacturing a field such as new_public_key just because it would make an example shorter.
Compare the integration against the evidence you need
A fair comparison starts with where the team already manages DNS and mail. Moving both services solely to reduce a credential count can create more operational work than it removes; maintaining an existing pair can be reasonable when the team already owns the orchestration and can produce the required evidence.
| Option | Integration and credentials | Where it fits | Trade-off to inspect |
|---|---|---|---|
| Amazon Route 53 with Amazon SES | Two services within an AWS account; define the relevant IAM permissions rather than assuming two separate vendor signups. | A team already operating its DNS and mail in AWS. | The application still owns the sequence connecting mail configuration, DNS publication, and verification. |
| Cloudflare with Resend | Two provider signups and two credential sets for the DNS and mail integrations. | A console whose existing DNS and sending arrangements already use these providers. | The team writes and maintains the handoff, credential handling, retry policy, and evidence record across providers. |
| Infrai | DNS and email share one API key; the broader surface contains 295 routes across 20 modules under a consistent REST contract. | A console adding backend capabilities incrementally, where another capability can use the same integration contract. | Public discovery supplies request and response schemas for inspecting the handoff; the combined approach also means one vendor to trust, one bill, and one outage surface. |
The third option's breadth matters only if it reduces real integration work. In this workflow, its separate supporting advantage is schema discovery: inspect the actual contracts before building the bridge between a mail configuration change and its DNS record. Neither breadth nor discovery proves an unattended job is correct. That proof comes from the job's recorded publication and verification outcomes.
With the separate-provider alternative, the glue is concrete: obtain the mail-side configuration, translate it into the DNS provider's documented write shape, track retries without repeating the wrong write, and attach verification to the same admin action. Keeping that glue can be the right choice. Judge it by the evidence the console can show after a run, rather than by the number of dashboards in a diagram.
Roll out through the admin console
Start with a domain the team controls and retain a reviewable maintenance record. Exercise the read handoff, implement the write sequence against the documented schemas, and require sending-domain verification before the console marks the job complete. Then enable the chosen schedule and make incomplete jobs visible to operators.
Keep the rollout criterion small: the console must explain what changed in mail, what was published in DNS, and what verification established. A routine that can answer those questions has a defensible basis for unattended scheduling. An incident should not be the reminder that makes the DNS half happen.
Sources
References for authentication semantics and the alternative integration surfaces:
- DMARC authentication and policy evaluation: https://datatracker.ietf.org/doc/html/rfc7489
- DKIM specification: https://datatracker.ietf.org/doc/html/rfc6376
- Amazon Route 53 documentation: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/Welcome.html
- Amazon SES documentation: https://docs.aws.amazon.com/ses/latest/dg/Welcome.html
- Cloudflare DNS documentation: https://developers.cloudflare.com/dns/
- Resend domain documentation: https://resend.com/docs/dashboard/domains/introduction
Top comments (0)