Keep one password reset token and one outbound record per request window, and reconcile an uncertain send before retrying it. For a storefront sending an account security compliance notice, delivery reliability starts with evidence that survives a timeout. Another email is a poor substitute for that evidence.
TL;DR: enforce exactly-once behavior for the logical reset request inside the application. Reuse its identity across retries, inspect stored send IDs and recent message history after an ambiguous result, and keep an audit record of the decision. That controls duplicate work; it does not establish exactly-once arrival in a customer's inbox.
The useful build artifact here is a fault-injection test for the reset workflow. A fast first API call earns little credit if the second call quietly creates another valid link. Benchmark that boundary before comparing integration polish.
Why does a retry after timeout cause duplicate password reset email sends?
A timeout proves only that the caller stopped waiting. It doesn't prove a failed send. Treating it that way creates the duplicate-email trap: the application generates another token and submits another message while the first operation may already have progressed. Now support has two messages to explain, and the account has competing credentials.
For this storefront design, the reset email accompanies an account security notice whose delivery history must be auditable. Keep the notice identity distinct from the credential: a compliance record may need to remain useful after a reset link expires. Neither an API response nor an authenticated sending domain establishes that a notice satisfies a particular legal requirement. Define the required evidence with the people responsible for that notice.
That constraint changes the implementation. A boolean called sent cannot explain an uncertain operation. The application needs a durable logical request, its outbound record, and the evidence collected while reconciling it. Preserve the notice version and link the outbound record to the reset token's internal identifier; keep the raw reset secret out of the audit history. Record observed states without upgrading provider acceptance into inbox delivery.
Uncertainty deserves storage.
Use short-lived reset tokens. Keep one token per request window, and invalidate older ones when a retry eventually succeeds. Define that transition explicitly so an overlapping request cannot leave several usable credentials behind. Token lifetime and the coalescing window are application policy choices; neither should be copied from a vendor's deduplication retention period.
Build the smallest useful retry experiment
Start with 1 account, 1 logical notice, and 2 workers attempting the same reset operation. Those are test inputs, not production measurements. The smallest working implementation is a durable outbound record with a uniqueness constraint for the logical request window, plus a worker that must claim that record before submission. Put token creation and outbound-record creation in the same application transaction. Otherwise a crash can preserve one without the other.
The worker stores a returned send ID as soon as it can. If a timeout prevents that, leave the operation unresolved. A replacement worker first examines the saved identifier, when present, and recent message history before deciding whether another send is justified. History can be useful evidence, but matching only a recipient address is weak: the same shopper can receive an order confirmation and a reset message close together. Require enough correlation to identify this logical notice. If the available evidence cannot resolve it, retain the uncertainty for reconciliation instead of manufacturing certainty with another token.
The build log should make the failure boundary reproducible. Run these 5 experiments against the application worker and its transport test double:
| Injected condition | Required observation |
|---|---|
| Two workers claim the same request window | One logical token and one outbound record survive |
| Transport times out after simulated acceptance | The record remains unresolved until reconciliation supplies evidence |
| A send ID is saved, then the worker exits | Recovery reads that ID before considering resubmission |
| Recent history contains another email to the same shopper | Recipient equality alone does not authorize a match |
| A reconciled retry succeeds while an older token exists | The older credential becomes invalid under the reset policy |
Measure time to the first successful call, time from ambiguity to reconciliation, duplicate logical submissions, and unresolved records remaining after each run. Publish the test conditions alongside any results. No latency or delivery-rate measurements are claimed here. An SDK installation stopwatch is useful, but the unresolved-record count is closer to this storefront's actual risk.
Keep the configuration small: one request-window policy, one token-lifetime policy, and explicit retry limits are enough to start testing the design. Every additional switch needs a failure case that justifies it. A page of configuration does not make uncertainty disappear.
For HTTP 429 responses, honor Retry-After when present and use exponential backoff. Keep the same logical identity through retries. Provider-side deduplication is an additional guard only where the specific send capability documents that guarantee; an application record still has to protect retries outside that guarantee's retention window.
Compare the evidence path before the send call
Infrai offers a plain REST API with one key, one wallet, and one bill. There is no SDK to install or client-library version to maintain; anything that sends HTTP can call it. A single API key covers 295 routes across 20 modules, reducing credential and billing administration if the notice worker later uses other backend capabilities. Its public, self-describing discovery surface requires no key, and documented capabilities include runnable examples in 10 languages, so an adapter author can inspect the contract before configuring credentials. The deciding test remains whether the worker can reconcile uncertain reset sends using saved identifiers and recent history.
Here is the smallest live read for the saved-ID branch. Run this TypeScript file with a TypeScript-capable runtime and set INFRAI_API_KEY, EMAIL_API_ORIGIN to the deployment's API origin, and EMAIL_SEND_ID to the identifier saved in the outbound record. The versioned path is supplied below. This read does not send another message. Its output belongs in the reconciliation workflow, with access restricted to the operators who need it.
const apiOrigin = process.env.EMAIL_API_ORIGIN; const sendId = process.env.EMAIL_SEND_ID; const apiKey = process.env.INFRAI_API_KEY; if (!apiOrigin || !sendId || !apiKey) { throw new Error("Missing required environment variables"); } const url = new URL(`/v1/email/get/${encodeURIComponent(sendId)}`, apiOrigin); if (url.protocol !== "https:") throw new Error("HTTPS is required"); async function readSavedSend(): Promise<void> { for (let attempt = 0; attempt < 5; attempt++) { const response = await fetch(url, { method: "GET", headers: { Authorization: `Bearer ${apiKey}` }, signal: AbortSignal.timeout(10000), }); const body = await response.text(); if (response.status === 429 && attempt < 4) { const header = response.headers.get("Retry-After"); const seconds = header === null ? NaN : Number(header); const serverDelay = header === null ? 0 : Number.isFinite(seconds) ? seconds * 1000 : Date.parse(header) - Date.now(); const delay = Math.max(1000 * 2 ** attempt, Number.isFinite(serverDelay) ? serverDelay : 0); await new Promise(resolve => setTimeout(resolve, delay)); continue; } if (!response.ok) { throw new Error(`Read failed (${response.status}): ${body}`); } console.log(body); return; } } readSavedSend().catch(error => { console.error(error); process.exitCode = 1; }); For independent alternatives, put Resend, Twilio SendGrid, and Amazon SES through the same harness. Their documentation is a starting point for verifying current behavior, not evidence that this storefront has achieved a delivery guarantee. Compare the integration work required to produce the audit record, rather than counting features on a landing page.
| Candidate | Concrete evaluation task | Fit boundary |
|---|---|---|
| Resend | Check its documented idempotency behavior against the reset request identity and retry horizon | Choose it if the email workflow and documented deduplication contract cover the required retry tests |
| Twilio SendGrid | Trace the mail-send result and documented event information into the notice record | Choose it if that evidence path fits the team's delivery workflow; account for adapter and correlation work |
| Amazon SES | Trace the send result and documented event publishing into the same record | Choose it if the operational setup fits the storefront's environment and passes the recovery tests |
These are different integration decisions, not a delivery leaderboard. A team already operating one of these systems should measure the cost of changing its evidence pipeline before adding another provider. The limitation of a plain send call is the same in every evaluation: it cannot replace application-level correlation and recovery.
What would change at scale
Start the workflow with immediate reset messages. A short-lived credential and a delayed security notice have conflicting lifecycles, so keep the durable notice record independent from the token and avoid scheduling credentials that may need revocation before dispatch.
At higher volume, give unresolved operations their own reconciliation work queue, track their age, and prevent an aggressive retry loop from consuming the capacity needed for new account notices. These are proposed application controls, not claims about any provider's throughput. Reconcile delivery evidence after submission; expire or invalidate credentials through the application's reset policy. The trade-off is deliberate: holding an ambiguous operation for investigation may delay a customer's next email, while resubmitting immediately may create duplicates and obscure what happened. Set an escalation deadline appropriate to the storefront's notice obligations, and record why a retry was authorized.
For fallback channels, require the same correlation and audit criteria before adding another transport. More channels create more states to explain.
Ship when the failure tests demonstrate one logical reset operation and an honest evidence trail across recovery. Keep the benchmark harness. It is a better defense against duplicate sends than another configuration file.

