A healthtech signup needs a verification link, but a successful email API response cannot carry the whole compliance argument. The design constraint is evidence: what can the team show about its custom sending domain, its decision to send, and the eventual account verification?

TL;DR: For a basic US/EU SaaS welcome email, authenticate the custom domain with SPF and DKIM before sending through an HTTP API. Keep four evidence gates: domain readiness, send eligibility, dispatch recording, and link redemption. Treat these as engineering controls to evaluate with your compliance reviewer, not proof that a provider or application meets a particular legal standard.

The tempting first implementation is a signup handler that sends a welcome email and marks verification complete when the request succeeds. That conflates dispatch with identity evidence. The chosen design keeps account verification behind link redemption and records dispatch separately. This is a design experiment with acceptance criteria, not a report of measured delivery performance.

What does a successful first email actually prove?

Less than signup code often asks it to prove. Domain authentication, a send response, delivery events, and a redeemed verification link answer different questions. DKIM addresses signatures associated with a sending domain; it doesn't establish that a particular patient owns an account. A delivery event belongs in the dispatch record. The application should decide account verification from its own redemption flow.

Keep them separate.

For a solo builder shipping LLM features, that separation is also a useful scope boundary. The verification message can use fixed transactional content or a reusable template. Introducing generated prose would add another output to review without advancing the immediate job: deliver one account verification link. Reserve model calls and their token budget for the feature that needs them. This is a proposed implementation choice, not a claim about a measured cost difference. The simple send-and-mark-verified approach fails the acceptance criterion before any provider comparison begins: it has no independent evidence that the link was redeemed. A stronger design can still ship with a small application record rather than a large orchestration system.

Four gates around a custom-domain API send

Start with domain readiness. Verify the custom sending domain and establish SPF/DKIM before production dispatch. Retain the authentication check result and its observation time in the application evidence record. Authentication reduces an avoidable delivery risk; it doesn't promise inbox placement. A screenshot alone is a weak dependency for code that needs to decide whether it can send now.

The second gate is eligibility. Give the signup attempt a stable application identifier, check suppression before dispatch, and decide whether this request is entitled to another message. Bounces and complaints need an explicit suppression decision in the application flow. Keep the account verification decision out of this gate. For healthtech, a proposed evidence record should contain only the operational details the reviewer needs; the example below deliberately uses synthetic identifiers and stores no verification token or clinical content.

Third comes the dispatch record. Preserve the application attempt identifier and the response reference available from the selected provider. Make retries idempotent using the provider's documented mechanism. A retry caused by a timeout should remain the same logical attempt; an intentional new verification message needs its own policy. Don't assume that an application identifier, by itself, makes a remote write idempotent.

The fourth gate is redemption. Update account verification only through the application's verification-link flow, and record that decision independently of email events. Decide link lifetime and repeat-click behavior before release. Those are application policy choices here, not vendor features being asserted.

This costs state.

A small TypeScript domain check before the first send

The focused example reads the sending-domain record before dispatch. Set INFRAI_API_ORIGIN to the documented HTTPS API origin, INFRAI_API_KEY to your credential, and SENDING_DOMAIN to your registered custom domain. Save the program as a TypeScript file and run it with your project's TypeScript runner in a Node.js runtime with built-in fetch. It makes a read-only request and prints the returned record; it doesn't send mail or assert that domain authentication passed.

async function main(): Promise<void> { const origin = process.env.INFRAI_API_ORIGIN; const key = process.env.INFRAI_API_KEY; const domain = process.env.SENDING_DOMAIN; if (!origin || !key || !domain) { throw new Error("Set the API origin, API key, and sending domain"); } const url = new URL( `/v1/email/domain/get/${encodeURIComponent(domain)}`, origin, ); if (url.protocol !== "https:") { throw new Error("The API origin must use HTTPS"); } for (let attempt = 0; attempt < 4; attempt++) { const response = await fetch(url, { method: "GET", headers: { Authorization: `Bearer ${key}` }, }); const body = await response.text(); if (response.status === 429 && attempt < 3) { const retryAfter = response.headers.get("Retry-After"); let delayMs = 1000 * 2 ** attempt; if (retryAfter !== null) { const seconds = Number(retryAfter); const serverDelay = Number.isFinite(seconds) ? seconds * 1000 : Date.parse(retryAfter) - Date.now(); if (Number.isFinite(serverDelay)) { delayMs = Math.max(delayMs, serverDelay); } } await new Promise<void>((resolve) => setTimeout(resolve, delayMs)); continue; } if (!response.ok) { throw new Error(`Domain lookup returned ${response.status}: ${body}`); } console.log(JSON.stringify({ domain, observedAt: new Date().toISOString(), responseBody: body, })); return; } } main().catch((error: unknown) => { console.error(error instanceof Error ? error.message : String(error)); process.exitCode = 1; }); 

The example allows 4 attempts and honors a server retry delay on rate limiting. Only configure the trusted API origin: the bearer credential goes to that host. Review the returned domain record against its documented schema before authorizing dispatch. A successful lookup alone doesn't establish SPF/DKIM correctness, eligibility, or freshness. This read is safe to repeat; the eventual send needs its own documented idempotency mechanism.

Ship a check whose meaning is narrow enough to defend, then connect the HTTP send after it passes.

Compare providers by the evidence you need to retain

Use Amazon SES, Twilio SendGrid, and Postmark as three real comparison candidates. Their official documentation provides separate starting points for investigation. The table assigns each candidate a concrete evaluation task; it doesn't claim that any has already passed a healthtech compliance review or a delivery benchmark.

Candidate Evaluation task for this signup flow Limit on the decision
Amazon SES Trace custom-domain authentication through the official developer guide, then identify the evidence the application would retain. Reject an integration plan that cannot explain the retained evidence, regardless of its sending result.
Twilio SendGrid Review its mail integration documentation against the application's suppression and dispatch-record requirements. A documented send operation alone cannot justify marking an account verified.
Postmark Review the developer documentation against the narrow transactional-link workflow and its operational handoff. Suitability still depends on the required event handling and contractual review.

These are deliberately different review assignments, not a feature ranking. Before selecting among the three, run every candidate through all four gates and compare the same required artifacts. The available evidence here doesn't establish a winner on contracts, retention, regional processing, or legal eligibility. Request those answers explicitly rather than inferring them from a product category.

Infrai offers a plain REST API with one key, one wallet, and one bill. Its self-describing API includes public discovery with request and response schemas, so the signup integration can be reviewed without installing an SDK or guessing fields. Anything that can issue an HTTP request can call it. For a builder combining email with LLM features, unified billing and a single API key also reduce credential and invoice administration. This fits basic welcome and transactional email, with boundaries: application code uses HTTP rather than SMTP relay, event tracking uses polling rather than webhook push, and the application must manage suppression explicitly.

The main limitation is polling: this is not suitable for a design that requires webhook-driven orchestration without an application polling layer. If immediate event-driven journey orchestration is an acceptance requirement, take that requirement to the other candidates before choosing. The trade-off is less client-library maintenance in exchange for application-owned event collection. Keep verification-link creation and redemption in the application; don't assume a managed email OTP flow. Schedule immediate signup dispatch through the application rather than building this design around canceling scheduled mail. This comparison also supplies no basis for a domestic-China compliance claim.

A narrow REST integration can reduce client-library maintenance. It doesn't remove the work of retaining evidence.

Measure the evidence gap before copying the design

The useful experiment is a synthetic signup through the complete application flow. Observe the domain check, dispatch decision, eventual event observation, and link redemption separately. Record time to dispatch response, time to observe delivery status, and time to redemption as distinct measurements. No latency values are claimed here.

For a polling workflow, measure how old the observed event can be when a support or compliance decision reads it. A fast HTTP response cannot answer that question. Also test a repeated dispatch request and a suppressed recipient: the expected application outcomes are one logical dispatch for the retry and no authorized send for the suppressed address. Verify those outcomes in retained records, not just console output. Don't promote opens into verification evidence. Apple's Mail Privacy Protection is another reason to review how engagement signals are interpreted. The decision that matters here remains the application's recorded link redemption.

Before launch, have the reviewer identify the required retention period and contractual evidence, then check that the chosen provider and application can supply them. Prefer the smallest implementation that meets those requirements. A signup link shouldn't require an LLM call, a vendor-specific orchestration layer, or a claim that email delivery proves compliance.

References

Primary references for implementation review and the comparison candidates follow.

Sources