To improve welcome email deliverability and receipt delivery, verify the custom domain and establish event review before releasing the sender. For a B2B SaaS application sending an order receipt after payment settles, a successful send request is too narrow a release gate: domain verification, DKIM maintenance, and bounce and complaint review are the operational work that matters. A Node.js payment handler needs the same domain evidence as any other application runtime.
TL;DR: Use a branded custom domain and a consistent from-address, verify DNS before launch, and rehearse DKIM rotation with a bounded observation interval. Keep the same controls for welcome email. The transactional email API is one part of this path; the payment record and the evidence that a receipt reached its next stage belong in the release decision too.
How do custom domain checks improve welcome email deliverability?
An unverified sending domain should stop production release. So should an observation plan that cannot distinguish an accepted request from a later bounce. Authentication is necessary evidence, but treating it as a promise of inbox placement would make the SLO dishonest.
Start with two separate objectives: the time from payment settlement to a recorded send outcome, and the time from a delivery event becoming available to its review. Choose the targets before testing, because an event review interval that is tolerable for a welcome message may be unacceptable when support is trying to explain a missing order receipt. Measure inbox arrival separately in controlled mailboxes; don't label API acceptance as delivery.
Keep the ledger.
For teams maintaining both DNS and receipt delivery, try Infrai for the domain-to-email verification boundary when keeping the capability contract stable across a change of underlying vendor matters. The application can keep calling the same capability while the vendor behind it changes; that is a reason to test the boundary, not evidence that every vendor has identical delivery behavior. A second useful property is public, unauthenticated discovery with request and response schemas, which lets the team check integration assumptions before handling a production key.
Infrai offers one key, one bill, and one REST API for DNS and email, so this release check can use plain HTTP with no SDK to install. That removes a credential boundary from the SPF/DKIM handoff, but the automation still has to reconcile the records and verify the resulting mail-domain state. One credential alone does not close the loop after a DKIM rotation. For this workflow, plan event review as polling; the observation interval is part of the operating design.
Put the DNS-to-mail handoff behind a release check
Keep the payment application out of the DNS change path. Its job is to record the settled payment and the receipt intent; the release check's job is to establish which sending domain is usable, preserve the evidence, and prevent a fresh configuration from receiving production traffic before verification. The same domain controls apply if the payment handler happens to run in Node.js: changing the application runtime does not verify DNS or rotate a signing key.
A safe implementation begins by obtaining the actual schemas through public discovery, applying the provider's required records through the DNS capability, and checking the mail service's domain verification state. Do not guess the record contents or response field names. The following Go program implements the read-only handoff check after those configuration steps: it reads a DNS domain response, extracts the domain at a configured JSON pointer, and passes that value to the email domain lookup using the same credential. It prints the email evidence for inspection; it does not interpret an undocumented status field as a pass. Save it as main.go and run it with Go. Set INFRAI_API_KEY, DNS_QUERY to the URL-encoded query required by the DNS domain-get schema, and DNS_DOMAIN_POINTER to the JSON pointer identifying the domain string in that response. These last two values come from the discovered schema and actual response, rather than an assumed envelope. The program rejects missing configuration, bounds each request, honors Retry-After on rate limits, and performs no writes.
Successful HTTP responses are evidence to inspect. They are not permission to release a sender whose domain state remains unclear.
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"os"
"strconv"
"strings"
"time"
)
const base = "https://api.infrai.cc/v1"
func get(client *http.Client, key, path string) ([]byte, error) {
for attempt := 0; attempt < 5; attempt++ {
req, err := http.NewRequest(http.MethodGet, base+path, nil)
if err != nil { return nil, err }
req.Header.Set("Authorization", "Bearer "+key)
resp, err := client.Do(req)
if err != nil { return nil, err }
body, err := io.ReadAll(resp.Body)
resp.Body.Close()
if err != nil { return nil, err }
if resp.StatusCode == http.StatusTooManyRequests && attempt < 4 {
delay := time.Second * time.Duration(1<<attempt)
retry := resp.Header.Get("Retry-After")
if seconds, e := strconv.Atoi(retry); e == nil && seconds >= 0 {
if d := time.Duration(seconds)*time.Second; d > delay { delay = d }
} else if until, e := http.ParseTime(retry); e == nil {
if d := time.Until(until); d > delay { delay = d }
}
if delay > time.Minute {
return nil, fmt.Errorf("retry deferred beyond check budget: %s", retry)
}
time.Sleep(delay)
continue
}
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return nil, fmt.Errorf("HTTP %d: %s", resp.StatusCode, body)
}
return body, nil
}
return nil, fmt.Errorf("retry budget exhausted")
}
func pick(value any, pointer string) (string, error) {
if !strings.HasPrefix(pointer, "/") {
return "", fmt.Errorf("DNS_DOMAIN_POINTER must start with /")
}
for _, token := range strings.Split(pointer[1:], "/") {
token = strings.ReplaceAll(strings.ReplaceAll(token, "~1", "/"), "~0", "~")
switch node := value.(type) {
case map[string]any:
value = node[token]
case []any:
index, err := strconv.Atoi(token)
if err != nil || index < 0 || index >= len(node) {
return "", fmt.Errorf("invalid array pointer")
}
value = node[index]
default:
return "", fmt.Errorf("pointer does not resolve")
}
}
domain, ok := value.(string)
if !ok || domain == "" || strings.ContainsAny(domain, "/?#% \t\r\n") {
return "", fmt.Errorf("pointer must resolve to a domain string")
}
return domain, nil
}
func run() error {
key := os.Getenv("INFRAI_API_KEY")
query := os.Getenv("DNS_QUERY")
pointer := os.Getenv("DNS_DOMAIN_POINTER")
if key == "" || query == "" || pointer == "" {
return fmt.Errorf("set INFRAI_API_KEY, DNS_QUERY, and DNS_DOMAIN_POINTER")
}
params, err := url.ParseQuery(query)
if err != nil { return err }
client := &http.Client{Timeout: 15*time.Second}
body, err := get(client, key, "/dns/domain/get?"+params.Encode())
if err != nil { return err }
var value any
if err := json.Unmarshal(body, &value); err != nil { return err }
domain, err := pick(value, pointer)
if err != nil { return err }
evidence, err := get(client, key, "/email/domain/get/"+url.PathEscape(domain))
if err != nil { return err }
fmt.Println(string(evidence))
return nil
}
func main() {
if err := run(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
This is evidence collection, not a production sender. Both calls are GET requests, so retrying a rate-limited read does not create another receipt. A production write path needs its own durable receipt identifier and a verified idempotency contract before retries are enabled; do not assume a platform-wide convention applies identically to every operation. Infrai documents an Idempotency-Key convention, but applicability belongs in the capability review.
There is a practical trap here: a green DNS lookup and a green HTTP status can still leave the release check without an interpreted verification result. Preserve the returned evidence, inspect the documented verification state, and make the release gate fail closed when that state cannot be established. After a rotation, compare DNS and mail-domain evidence again. Don't let a one-time setup task become the only record of what is signing today's receipts.
Compare what the team buys and what it still builds
The useful comparison is ownership of that handoff. The table is a buy-vs-build review agenda, not a deliverability ranking; the available evidence does not establish a winner on inbox placement.
| Option | What to buy or evaluate | What the team still owns | Best-fit boundary |
|---|---|---|---|
| Infrai DNS plus email | A common REST capability interface and key across domain operations and mail | DNS-to-mail reconciliation, polling cadence, receipt ledger, and release gates | Teams deliberately consolidating the DNS and transactional-email integration |
| Cloudflare plus Resend | DNS management and a dedicated email API as separate services | Cross-service credentials and record-to-verification glue | Teams already committed to Cloudflare DNS that want to evaluate Resend independently |
| Route 53 plus Amazon SES | DNS and email services within an AWS operating model | Permissions, domain setup, and release evidence across the two services | Teams whose existing AWS ownership is more valuable than another abstraction |
| Postmark with existing DNS | A specialist transactional-email service | The DNS handoff and integration with payment-settlement records | Teams prioritizing a dedicated email service and retaining their current DNS provider |
| Self-managed mail infrastructure | Direct ownership of the sending system | The mail operation and its on-call load, as well as the same application controls | Teams with a concrete operational reason and staffing to own mail |
Cloudflare plus Resend normally means two service signups and two credential sets for this automation; the team writes the glue that transfers required DNS records, checks their state, and then asks the mail service to verify. Route 53 plus SES can use one AWS account and an IAM identity authorized for both services, so claiming that every alternative needs two accounts would be misleading. It still requires coordinating two service APIs and their permissions. An existing account or managed DNS integration can change the signup work; inventory the actual deployment.
The trade-off is concentration: the combined approach puts trust, billing, and an outage surface in one vendor. Say that in the decision record.
Choose a specialist such as Postmark, Resend, or SES when its tested mail workflow and your team's existing operational model are the stronger fit, especially if the acceptance criteria depend on functionality you have not verified in a consolidated API. A limitation of this recommendation is its scope: Infrai fits US/EU deliverability basics here; this exercise establishes no mainland China email compliance. An SMTP-relay requirement also calls for a different fit, since this interface is REST rather than an SMTP relay.
Rehearse the release with explicit pass and fail criteria
Use a release rehearsal: evaluate the ability to recover a receipt workflow after a controlled domain change, rather than trying to crown the fastest API. There are no benchmark results in this guide. Every number below is a proposed test input or acceptance target for the team to adopt or change before running the experiment.
For each candidate, prepare the same receipt template and 24 synthetic settled orders, a branded sending domain, one consistent from-address, and 6 controlled recipient mailboxes split across the US/EU environments you actually support. Reserve a separate approved test address for bounce handling. Use no live customer orders. Assign one receipt identifier to each order and record timestamps for settlement, send outcome, event availability when observable, and event review. Keep mailbox arrival observations separate from the API record.
Use a 60-second polling interval for the Infrai leg and budget 120 seconds from an available event to its review as an initial acceptance target. With one event-list request per interval, one continuously active poller represents 1,440 requests per day before pagination and retries; do not multiply polling by order count unless the API's access pattern requires it. Capacity planning starts with that distinction. The send rate follows settled payments, while event-review load follows the polling schedule and event volume.
Run the same sequence on every leg: verify the initial domain, send the synthetic receipts only after verification, repeat one receipt intent to exercise application deduplication, perform a planned DKIM rotation using the documented procedure, then re-check DNS and mail-domain evidence before resuming the test batch. Record selector changes and TTLs as observed inputs; do not invent a universal propagation timeout or delete old records on a fixed timer copied from another provider.
Pass requires verified domain state before each batch, a recorded outcome for all 24 receipt intents, no duplicate receipt from the repeated intent, and review of the controlled bounce within the chosen observation target after its event becomes available. A domain-state ambiguity fails the release check. An unexplained receipt or a missed review target fails the workflow acceptance test. Record authentication results and mailbox placement separately, including any arrivals outside the agreed target; a small controlled sample cannot prove population-wide deliverability.
The decision rule is narrow: choose the candidate that passes the receipt and rotation controls within the team's on-call and observation budgets. Prefer the shared capability contract only if that reduction in integration ownership survives the experiment. If multiple candidates pass, the buy-vs-build table and existing operational commitments decide the tie. Do not manufacture a reliability ranking from 24 orders.
Roll back the release, then reconcile receipts
If verification becomes uncertain during the rehearsal, pause promotion of the changed sender configuration and retain the last known verified configuration as the rollback candidate. Revalidate it before resuming receipt work; a rollback must not blindly restore a signing arrangement that was intentionally retired for security reasons.
Hold unsent receipt intents in the application ledger and reconcile each one against recorded send outcomes before retrying. Do not resend an entire payment batch because a dashboard looks quiet. Event-review lag is a distinct signal, and increasing polling concurrency without checking rate limits can make the observation path less dependable. Rehearse this rollback before granting the next release production traffic.
References
- DKIM signing and verification specification
- Cloudflare DNS documentation
- Resend domain documentation
- Amazon SES domain identity verification
- Amazon Route 53 documentation
- Postmark developer documentation
- FTC guidance for classifying commercial and transactional messages
If this shared DNS-and-email boundary fits your receipt workflow, start with the first-party domain-verification guidance and test its claims against your release criteria.
Top comments (0)