Get the seller back into the property-management marketplace with an application-owned password reset email API route and a custom HTML template, then keep enough evidence to explain the handoff. The operating bill contains send attempts, status retrieval, and retained diagnostic data; the controllable multiplier is how often the application observes the same unresolved message. As an illustrative polling budget, one observation cycle per minute means 60 cycles per hour; one every five minutes means 12. Those are scheduling counts, not measured API consumption or dollar costs, and they establish the dominant term only in a design where repeated observation outweighs dispatch and retained bytes.
TL;DR: For a Next.js API route or Node.js backend, look up the user, create a reset token, check suppression, and send a custom HTML template containing the reset link. Keep a bounded delivery record, poll for email events, and expire diagnostic details deliberately. A seller waiting to act on a new order needs a usable recovery link; keeping more copies of that link does not make delivery more reliable.
The useful change is to retire resolved messages from active investigation and slow observation of older unresolved messages according to an explicit response budget. That changes the repeated-work term. It also accepts a longer interval before the application notices a new event. A retention policy should make that trade visible before anyone mistakes a cheaper observation schedule for faster delivery.
What should a password reset email API route retain about custom HTML?
Begin at the end of the investigation. Support needs to distinguish an account recovery request from the new-order notification that brought the seller back, determine whether the recovery message was suppressed or accepted for sending, and identify the latest delivery evidence the application actually observed. The two messages need separate correlation records, even if both concern the same seller and order, because successful delivery of the order notification proves nothing about the reset message.
Keep that distinction.
For this design, the durable record is a small application ledger containing a recovery request identifier, timestamps, a template revision, a suppression decision, and a provider message identifier when the documented response supplies one. Record the time of observation separately from an event's time when available. These are proposed application fields, not claims about a vendor response schema, and each field needs a purpose that survives review by the person investigating a missing message.
The reset credential has a different job. The application should enforce its expiration and single use, keep it out of support records, and avoid retaining rendered HTML that embeds it. A template revision helps explain which content was intended; it cannot establish exactly what a recipient's mail client displayed. Keeping an old token-bearing message to answer that narrower presentation question is a poor default for a recovery system.
This is an evidence lifecycle decision: retain a dispatch explanation, then deliberately shed content that can authorize an account change. Storage durability cannot repair an evidence model that preserves the wrong thing.
Give each retained item a deletion condition
Use deletion conditions tied to purpose before choosing a universal retention period. The application needs one policy for an active recovery credential, another for unresolved delivery investigation, and another for aggregate operational accounting. A single expiration setting collapses those purposes and tends to preserve sensitive content for the longest-lived consumer.
The following table is a proposed policy for the marketplace, not a statement about any provider's retention guarantees.
| Application data | Keep it for | Delete or reduce it when | Cost of that decision |
|---|---|---|---|
| Active reset credential state | Validating the recovery action | The credential expires or is consumed, subject to the application's replay controls | Support cannot revive the old credential; the seller needs a new recovery request. |
| Rendered HTML containing the reset URL | Immediate template validation in development | Validation is complete; exclude live reset URLs from retained test artifacts | An exact historical message body is unavailable. |
| Correlated delivery observations | Investigating an unresolved message | The defined investigation window closes | Late complaints may have only the final retained summary. |
| Template revision and redacted dispatch summary | Explaining the intended message and dispatch decision | The application's documented audit purpose ends | Very old cases lose their detailed reconstruction path. |
Deletion needs an owner.
Otherwise, a useful support export becomes an indefinite second archive, detached from the policy that governed the primary database. The same review should cover request logs and exception reporting: deleting a message body from one table accomplishes little if a reset URL survives in an error attachment. Consider the proposed investigation sequence in concrete terms: a seller reports that the new-order notification arrived but the recovery email did not, support locates the recovery correlation record rather than the order record, and the ledger supplies the suppression decision and most recent observation time. That sequence requires identifiers and bounded evidence. It doesn't require a support operator to retrieve an active reset credential, and a policy that keeps the whole message merely because it might be useful later has failed to distinguish investigation from authorization.
The arithmetic is uncomplicated, but its interpretation matters. Retained byte-time depends on record size, record count, and duration; polling work depends on observation frequency and the unresolved population. Neither formula identifies the largest monetary term without actual workload and billing data. Measure those inputs before declaring a storage optimization the financial justification for a sender migration.
Fit the API route around the evidence lifecycle
A password reset email API route should own the identity decision and token lifecycle. In a Next.js or Node.js application, receive the request, look up the user, create the recovery token, and prepare the link for the custom HTML template. Use a consistent outward response so the recovery endpoint does not disclose account membership. Persist the correlation record before the dispatch outcome can become detached from the request that caused it.
Suppression is a dispatch decision. Check it before sending to avoid repeatedly targeting blocked or bounced addresses, and record the decision without treating it as a permanent authorization for future sends. A successful check cannot guarantee inbox placement. An indeterminate check should leave the application with an unresolved decision, rather than silently becoming permission to dispatch.
Infrai fits this boundary through a plain REST API with no SDK to install, one API key, and unified billing across backend modules. An HTTP-capable backend can call it without maintaining a client-library version; the single key and single bill reduce credential administration and invoice reconciliation if the marketplace already uses other capabilities through that interface. Template preview and suppression checks support the reset workflow, while email-event polling fits an application that explicitly budgets for observation delay and owns recovery authorization.
The minimal Python example below inspects suppression before dispatch, using the documented read operation without inventing a send payload or a suppression-response field. Supply the documented API base ending in /v1 through INFRAI_BASE_URL, an API key through INFRAI_API_KEY, and the seller address through RESET_EMAIL. Run it in a private development terminal: the returned JSON is for schema inspection and may contain recipient information. Production code should interpret the documented suppression result and retain only its redacted decision.
import email.utils
import json
import os
import time
import urllib.error
import urllib.parse
import urllib.request
class NoRedirect(urllib.request.HTTPRedirectHandler):
def redirect_request(self, req, fp, code, msg, headers, newurl):
return None
base = os.environ["INFRAI_BASE_URL"].rstrip("/")
if urllib.parse.urlsplit(base).scheme != "https":
raise ValueError("Configure the documented HTTPS API base")
recipient = urllib.parse.quote(os.environ["RESET_EMAIL"], safe="")
request = urllib.request.Request(
base + "/email/suppression/check/" + recipient,
headers={"Authorization": "Bearer " + os.environ["INFRAI_API_KEY"]},
method="GET",
)
opener = urllib.request.build_opener(NoRedirect())
for attempt in range(5):
try:
with opener.open(request, timeout=20) as response:
if not 200 <= response.status < 300:
raise RuntimeError(f"Unexpected HTTP {response.status}")
result = json.load(response)
print(json.dumps(result, indent=2))
break
except urllib.error.HTTPError as error:
if error.code != 429 or attempt == 4:
reason = error.read().decode("utf-8", errors="replace")
raise RuntimeError(f"Suppression HTTP {error.code}: {reason}") from None
delay = float(2 ** attempt)
retry_after = error.headers.get("Retry-After")
if retry_after:
try:
requested = float(retry_after)
except ValueError:
requested = (
email.utils.parsedate_to_datetime(retry_after).timestamp()
- time.time()
)
delay = max(delay, requested)
time.sleep(delay)
This is a read-only suppression inspection, not a complete recovery server. Account lookup, token redemption, and the final send remain application integration work. Don't infer permission to send from a successful HTTP status alone.
Retries require a separate decision. A dispatch timeout leaves uncertainty about acceptance, so the same logical recovery request needs a stable application identity across retries. The platform's default idempotency deduplication window is 24 hours; an application investigating requests over a longer period still needs its own dispatch record. Suppression checks, request throttling, token validity, and dispatch deduplication address different failure modes and cannot substitute for one another.
Choose a sender by the evidence you can operate
Delivery reliability is the selection axis for this seller workflow, but no measured delivery ranking follows from an API description. Compare the operational boundary instead: what the application must correlate, how it obtains current evidence, and how much provider-specific integration it is willing to own.
| Option | Boundary to evaluate | Appropriate fit and selection limit |
|---|---|---|
| Resend | A dedicated email integration, evaluated through its email API documentation | A candidate when the application wants a focused email relationship; verify template handling, suppression decisions, and evidence collection against this recovery policy. |
| SendGrid | Its Mail Send integration as a separate dispatch boundary | A candidate when the team wants to own a dedicated mail integration; map sending and operational evidence separately before accepting it for recovery traffic. |
| Amazon SES | A dedicated sending service within an AWS operating boundary | A candidate when AWS is already the chosen operational environment; check how the application's recovery ledger connects to the selected sending and evidence configuration. |
These are real alternatives, not a claim that their delivery behavior is interchangeable. A focused mail service and a broader REST interface create different ownership boundaries; neither boundary establishes that a seller will see a particular message. Use the linked primary documentation to validate the exact configuration, then evaluate it with the marketplace's sender domain, templates, and recovery policy. An unmeasured uptime or inbox-placement claim should not decide the purchase.
The limitation of the proposed polling design is delayed observation; it is not suitable for a workflow that requires immediate event-driven orchestration. Choose a dedicated sender configuration with documented event delivery for that requirement, and verify its contract before committing. This is a trade-off: a smaller integration surface leaves the application responsible for more observation policy.
Channel scope also matters. If the workflow requires SMTP relay, voice, WhatsApp, or RCS, evaluate a service that explicitly documents those requirements. A phone fallback should be a separate design review, with verified recipient ownership, geographic abuse controls, and country-based spending limits owned by the application. Do not turn an email suppression decision into an automatic text-message authorization.
Diagnose missing mail before retaining more mail
Template preview addresses presentation: validate the reset-link rendering on desktop and mobile clients, and make the action unmistakable. The recovery email should explain account access; the order notification should explain the order. Mixing both purposes into one message gives support a harder question and the seller an ambiguous link.
DKIM addresses a different layer. RFC 6376 defines domain-level message signing; a signature is not an inbox-placement guarantee. Check domain authentication separately from suppression and HTML rendering, because a green preview cannot explain a rejected recipient and an accepted send cannot prove that the seller opened the message.
For delivery troubleshooting, poll email events and retain the last successful observation time. Treat a stale observation, duplicate dispatch, suppressed recipient, broken template link, and expired recovery token as separate failure modes. Otherwise the dashboard will label each of them “email failed,” which encourages another send even when another send cannot resolve the problem.
The observation budget from the opening now has a practical consequence. Moving an illustrative schedule from one-minute to five-minute cycles reduces scheduled cycles from 60 to 12 per hour, but leaves a wider interval in which a new event may remain unseen. How many requests that produces depends on batching, pagination, and the documented retrieval behavior. Stop active polling only under a defined resolution or investigation-expiry rule; an absence of new evidence is not proof of delivery.
The deliberate stopping point is equally explicit: stop keeping live reset URLs, full rendered production messages, and indefinite copies of every observation. Retain the redacted explanation for the chosen investigation window. When something goes wrong after that window, support may be able to explain the dispatch decision without reconstructing the exact historical message, and the seller may need a fresh recovery request. That is the cost of bounded evidence. Decide whether it is acceptable before deleting the first record.
References
The comparison uses the official sending documentation below as its starting point, and RFC 6376 for the boundary between message signing and delivery evidence. These references do not establish a comparative delivery benchmark or a shared retention guarantee.
Top comments (0)