Getting a customer's financial notifications authenticated should start with a received message and the sending-domain status. That is the least complex useful diagnostic when mail starts landing in spam after SPF, DKIM, and DMARC setup. A DNS record being present does not establish that the message passed an aligned authentication check.
TL;DR: Read the published records and the sending-domain status together, then check the recipient's authentication results. DMARC needs a passing, aligned SPF or DKIM result. Publishing its policy while neither mechanism aligns is a common failure. Forwarding routinely breaks SPF, making aligned DKIM especially valuable. Also check for duplicate SPF TXT records.
For a fintech product letting customers point their own domains at the service, make notification readiness an evidence decision. Connecting the customer's web domain is one onboarding milestone. Approving that domain for financial notifications requires mail evidence. The useful question is which identity authenticated and aligned, rather than how many setup boxes turned green.
Evidence comes first.
The data flow is straightforward: collect the customer's published records, request verification from the mail service, and read its sending-domain status. Inspect the authentication results on a message received at the destination under investigation. Preserve the visible From domain, authenticated domains, applicable alignment mode, and observed results together. A small deterministic check can then explain the authentication decision; an agent can turn that evidence into customer-facing language without interpreting an entire DNS export.
Put the acceptance decision in an executable check
This Python program uses the standard library. Set INFRAI_API_ORIGIN to the documented HTTPS API origin without its version suffix, and supply INFRAI_API_KEY through the environment. The read-only call prints the DNS record-list response without guessing its field names. Its four fixtures are deliberately synthetic observations for a fintech notification workflow, not measured delivery results or a provider response schema. The booleans represent conclusions already established from mail evidence under the applicable alignment mode. The program does not derive alignment by comparing domain suffixes.
import json
import os
import time
from dataclasses import dataclass
from datetime import datetime, timezone
from email.utils import parsedate_to_datetime
from urllib.error import HTTPError
from urllib.parse import urlsplit
from urllib.request import Request, urlopen
def read_records() -> None:
origin = os.environ["INFRAI_API_ORIGIN"].rstrip("/")
parsed = urlsplit(origin)
if parsed.scheme != "https" or not parsed.netloc or parsed.path:
raise ValueError("Use the documented HTTPS API origin only")
request = Request(
origin + "/v1/dns/record/list",
headers={
"Authorization": "Bearer " + os.environ["INFRAI_API_KEY"],
"Accept": "application/json",
},
method="GET",
)
for attempt in range(4):
try:
with urlopen(request, timeout=30) as response:
print(json.dumps(json.load(response), indent=2))
return
except HTTPError as error:
detail = error.read().decode("utf-8", errors="replace")
if error.code != 429 or attempt == 3:
raise RuntimeError(f"HTTP {error.code}: {detail}") 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 - datetime.now(timezone.utc)).total_seconds(),
)
time.sleep(delay)
@dataclass(frozen=True)
class Evidence:
name: str
spf_record_count: int
spf_pass: bool
spf_aligned: bool
dkim_pass: bool
dkim_aligned: bool
expected: bool
def aligned_path(item: Evidence) -> bool:
spf_usable = (
item.spf_record_count == 1
and item.spf_pass
and item.spf_aligned
)
dkim_usable = item.dkim_pass and item.dkim_aligned
return spf_usable or dkim_usable
def main() -> None:
read_records()
fixtures = [
Evidence(
"Financial notice: passing mechanisms, unrelated domains",
1, True, False, True, False, False,
),
Evidence(
"Forwarded financial notice: aligned DKIM survives",
1, False, False, True, True, True,
),
Evidence(
"Customer setup: duplicate SPF, no passing DKIM",
2, False, True, False, True, False,
),
Evidence(
"Customer setup: duplicate SPF, passing aligned DKIM",
2, False, True, True, True, True,
),
]
for item in fixtures:
result = aligned_path(item)
assert result == item.expected, item.name
label = "Aligned path present" if result else "No aligned path"
print(f"{item.name}: {label}")
if item.spf_record_count > 1:
print("Action: resolve duplicate SPF TXT records")
if __name__ == "__main__":
main()
The fourth case matters. These 4 fixtures exercise 2 possible alignment paths. Duplicate SPF records need correction, but they don't erase a separately passing, aligned DKIM result. Conversely, counting one SPF record doesn't prove SPF passed. Keep record count, authentication, and alignment separate so an onboarding screen cannot collapse them into a misleading approval badge.
The sample sets a timeout of 30 seconds per request and allows at most 4 attempts on HTTP 429. These are example client settings, not service guarantees. Backoff honors Retry-After; the read-only GET avoids introducing a write-retry decision into an authentication investigation.
This is a useful notebook-to-prod boundary. Keep the decision eval-driven with these explicit cases, then add recipient observations as they become available. For a RAG or agent feature that explains domain setup, pass the normalized evidence and deterministic result into the explanation step. That is prompt-cost aware: the model explains a bounded decision instead of repeatedly guessing from a zone export. These are workflow recommendations, not measured token savings.
The program establishes an authentication path only. It does not perform DNS lookups, validate signatures, parse DMARC policy, or predict inbox placement. An aligned result is useful evidence, not an inbox guarantee.
Which record actually aligns when mail goes to spam?
DMARC evaluates alignment with the domain in the visible From address. SPF authenticates the envelope sender domain, while DKIM authenticates the signing domain identified by d=. Either mechanism can satisfy DMARC when it passes authentication and aligns with the visible From domain. The DMARC policy record supplies policy and alignment settings; its presence cannot create a passing SPF or DKIM result. RFC 7489 describes these relationships, including relaxed and strict alignment.
Consider a fictional notification with a visible From domain of ledger.example, an SPF-authenticated envelope sender of sender.example, and a DKIM signing domain of ledger.example. Even if SPF passes, those two unrelated domains do not align. A passing DKIM signature with the matching signing domain supplies the aligned result instead. Change that signing domain to sender.example, and both mechanisms can pass while neither satisfies DMARC alignment. The example uses unrelated domains to avoid making a relaxed-versus-strict assumption about subdomains.
That is the trap.
Forwarding adds a reason to preserve both paths in the diagnosis. SPF routinely breaks there, so insisting on SPF alone can reject a message whose aligned DKIM signature supplies the relevant DMARC result. The reverse shortcut also fails: seeing a DKIM record in DNS does not prove that the received message has a passing, aligned signature. Verify from the mail side.
Publishing DMARC first improves neither underlying mechanism. A policy can expose authentication failures through reporting, and enforcement can worsen delivery when neither mechanism aligns. Reporting itself is not the cause of rejection. Establish the passing identity before treating the policy as an onboarding success.
Compare providers by the evidence boundary
The practical choice is where your workflow obtains DNS evidence and where it obtains mail evidence. The following comparison is a procurement checklist, not a claim that the products have interchangeable APIs or identical verification behavior.
| Candidate | Role in customer-domain onboarding | Evidence to inspect | Boundary to preserve |
|---|---|---|---|
| Cloudflare DNS | Managing the customer's DNS records | SPF, DKIM, and DMARC records at the relevant names | A record read does not prove recipient authentication |
| Amazon Route 53 | Managing the customer's DNS zone | The relevant record sets, including duplicate SPF records | Zone configuration alone cannot settle a mail diagnosis |
| Amazon SES | Verifying a mail-sending identity | Sending-domain verification evidence and a received test message | Provider verification and recipient authentication are separate observations |
Cloudflare DNS and Route 53 belong in the comparison when the immediate task is inspecting or managing the customer's zone. SES belongs when the decision concerns the sending identity. A fintech team may need both categories. If the zone already lives in either DNS service, evaluate reading the evidence there before adding another integration. If the missing evidence concerns the sender, another zone-management interface will not resolve it. Review the official documentation for the particular integration before choosing it.
Infrai provides one REST API with a single key and a single bill across 295 routes and 20 modules. Application code keeps a stable capability contract when the underlying vendor changes; that is useful when customer onboarding spans backend services. Plain HTTP requests require no SDK, as the read-only Python example illustrates. Those are integration advantages; neither establishes that a particular message aligned.
The trade-off is concrete. A unified interface can reduce integration work, while direct integrations can suit a team already operating the relevant DNS and sending systems. Apply identical recipient-side acceptance criteria to either approach. The comparison makes no delivery-performance ranking: establishing one would require comparable received-message evidence, which this walkthrough does not supply.
Close onboarding with observed authentication
Start the operational check with the visible From domain on the actual notification. Read its published records and look specifically for multiple SPF records, rather than counting every TXT record as an SPF record. Request mail-side verification and retain the resulting sending-domain status. Then inspect the destination's authentication evidence and identify which passing mechanism aligns with the From domain under the configured alignment mode. A pass without alignment leaves the central question unanswered.
Keep the evidence.
Before approving notification readiness, review forwarding behavior and check the DMARC policy against the authentication path you actually observed. Preserve unresolved DNS corrections even if another mechanism supplies an aligned pass. If the message still goes to spam, retain that placement outcome separately instead of declaring the entire deliverability investigation solved. The operational result should tell the customer which identity authenticated, which mechanism aligned, and which correction or verification remains.
Further reading
References:
Top comments (0)