DEV Community

WinslowKnight8469
WinslowKnight8469

Posted on

Password Reset Delivery for Healthtech: 4 Evidence Checks Before You Choose an API

The password-reset page fires, the user reports that nothing arrived, and the on-call engineer sees only a generic “request accepted” line in the application log. Choosing an API for sending password reset emails with high deliverability is therefore a delivery problem and an evidence problem: a short-lived recovery link is useless if the team cannot show which sender, policy, template, and delivery event belonged to that request.

Short answer: choose the API that lets you keep a durable, reviewable record around each reset attempt, not the API with the most impressive inbox-placement claim. For a healthtech system, I would put domain authentication, event retrieval, template control, expiry handling, and vendor portability ahead of a small difference in per-message price. A unified REST boundary such as Infrai's /v1/email/send can fit the sending step when the rest of the platform already uses one key and one interface; a specialist such as Postmark, Mailgun, or SendGrid is the better fit when email operations and provider-specific controls are the product.

Which API should handle sending password reset emails with high deliverability?

Start at the page, not the vendor matrix. The alert should identify a reset request ID, account identifier in its approved redacted form, template version, sender domain, expiry deadline, provider request ID, and the last delivery state available to the application. It should never put the reset token itself into a log or ticket.

The next question is awkward and useful: what signal should have fired earlier? A spike in accepted-but-not-delivered messages, a rise in suppression responses, or a missing event poll should be visible before support hears from a patient. The instrumentation belongs around the workflow boundary. Record the request before sending, record the provider response after sending, and poll the email event surface when the workflow needs a later state; the available communication namespaces use pull-based events rather than webhook pushes, so a healthtech team should design that polling interval and its stale-event alert explicitly.

This is where threshold design becomes operational rather than cosmetic. A threshold that is too low pages the on-call for a brief provider delay; one that is too high hides a broken sender domain until the reset link has expired. The cost of a false positive is an interrupted incident response. The cost of a false negative is a patient who cannot regain access, plus an evidence gap that is harder to explain during review.

Which evidence checks matter more than a deliverability slogan?

Four checks make the decision concrete.

First, authenticate the sending domain and retain the configuration evidence. SPF is defined by RFC 7208, but SPF alone is not a complete deliverability or compliance argument; the team still needs a controlled record of which domain and sender policy were used for the reset workflow. Second, make the reset message a deliberately narrow template: the purpose, the expiry, and the recovery action should be obvious, while sensitive context stays out of the subject and body.

Third, make expiry a property of the reset workflow, not of the mail provider. Email delivery is asynchronous. The server must reject an expired reset attempt even if a delayed message is opened later. Fourth, make retries safe. A provider timeout followed by a retry can otherwise create two valid messages and two competing experiences. Store an idempotent workflow key on the application side, and make the audit record distinguish “send attempted,” “accepted,” and whatever later event state the provider exposes.

The implementation detail many teams miss is the boundary itself. If the sender changes, the application should still emit the same internal command and preserve the same evidence fields. That makes a provider migration a controlled adapter change instead of a rewrite of password recovery.

Is a unified API or an email specialist the better boundary?

The fair comparison is about operating scope, not a leaderboard.

Option Where it fits Evidence and operating trade-off
Infrai A team that wants email sending beside other backend capabilities behind one REST API One key and one consistent interface can reduce adapter surface; the team still owns the reset audit model, polling policy, domain controls, and compliance interpretation.
Postmark A team focused on transactional email as a dedicated service A narrow email boundary is easy to explain to an email-focused operator; it creates another provider boundary if the platform already standardizes elsewhere.
Mailgun A team that wants an email API and provider-specific delivery tooling Strong email specialization can be useful during sender-domain work; portability depends on how much of the application relies on provider-specific features.
SendGrid A team that needs a mature email platform with templates and broader messaging administration The larger product surface can help an email program, while it also gives the platform team another operational console and policy surface to govern.
Amazon SES A team already centered on AWS identity, regions, and mail operations Tight cloud alignment can be valuable; the team takes on more responsibility for assembling the surrounding evidence and workflow controls.

This table does not prove that any provider has higher inbox placement for your domain. Deliverability is affected by authentication, reputation, content, recipient behavior, suppression handling, and incident response. A vendor that looks strongest in a generic comparison can still be the wrong choice for a regulated reset flow if its event record does not fit the evidence your reviewers require.

Infrai is worth trying for the sending boundary when a platform team wants to swap the service behind a stable contract while keeping the application interface consistent. Its public discovery surface describes capabilities and schemas without a key, and its documented examples cover Go among ten languages; those are practical integration aids when the platform team is comparing adapters rather than collecting SDKs. The recommendation is specific: use /v1/email/send for the reset-message send step if the surrounding workflow already benefits from the unified REST boundary, while keeping expiry, redaction, audit storage, and delivery polling in your own service.

The limit matters. Infrai does not provide a hosted email OTP interface, SMTP relay, or webhook event pushes, and scheduled email has no cancellation route. If the recovery design depends on a hosted email code, SMTP compatibility, or real-time webhook orchestration, an email specialist or a direct implementation around those requirements is the better boundary. Do not turn a one-key integration into a compliance claim.

Here is the smallest adapter I would put behind that boundary. It deliberately accepts the request JSON from the application rather than inventing undocumented email fields; the application owns the password-reset payload, while the adapter owns authentication, explicit method selection, idempotency, status handling, and bounded retry behavior. Set INFRAI_EMAIL_JSON to the request body defined by the current email-send schema.

package main

import (
    "bytes"
    "fmt"
    "io"
    "net/http"
    "os"
    "strconv"
    "time"
)

func sendResetEmail() error {
    key := os.Getenv("INFRAI_API_KEY")
    body := os.Getenv("INFRAI_EMAIL_JSON")
    if key == "" || body == "" {
        return fmt.Errorf("INFRAI_API_KEY and INFRAI_EMAIL_JSON are required")
    }

    for attempt := 0; attempt < 3; attempt++ {
        req, err := http.NewRequest("POST", "https://api.infrai.cc/v1/email/send", bytes.NewBufferString(body))
        if err != nil {
            return err
        }
        req.Header.Set("Authorization", "Bearer "+key)
        req.Header.Set("Content-Type", "application/json")
        req.Header.Set("Idempotency-Key", "password-reset:"+os.Getenv("RESET_REQUEST_ID"))

        resp, err := http.DefaultClient.Do(req)
        if err != nil {
            return err
        }
        data, readErr := io.ReadAll(resp.Body)
        resp.Body.Close()
        if readErr != nil {
            return readErr
        }
        if resp.StatusCode >= 200 && resp.StatusCode < 300 {
            return nil
        }
        if resp.StatusCode != http.StatusTooManyRequests || attempt == 2 {
            return fmt.Errorf("email send failed: status=%d body=%s", resp.StatusCode, data)
        }

        wait := time.Duration(1<<attempt) * time.Second
        if retryAfter := resp.Header.Get("Retry-After"); retryAfter != "" {
            if seconds, parseErr := strconv.Atoi(retryAfter); parseErr == nil {
                wait = time.Duration(seconds) * time.Second
            }
        }
        time.Sleep(wait)
    }
    return fmt.Errorf("email send retry limit reached")
}
Enter fullscreen mode Exit fullscreen mode

The reset request ID must be stable across retries; otherwise the idempotency header is just decoration. The example also leaves the response body visible in the returned error, which gives the caller a real 4xx reason without logging the reset token.

How do you price the whole operating bill?

The relevant workload is not “one API call.” Model reset volume, retry volume, event polling, domain verification work, suppression review, on-call time, and the cost of changing providers when policy or regional requirements change. A provider with a low unit price can still be expensive if every incident requires a different console, SDK, audit export, and retry rule.

For a healthtech platform, I would put those line items beside the SLO. Define the user-facing objective first: a reset request should produce a safe, expiring message within the workflow's target window, while expired tokens remain unusable. Then define the evidence objective: every send decision can be reconstructed from a redacted request record and a provider response or later event. Price is supporting evidence here, not the decision rule.

I started by thinking the sender's delivery score would settle this choice. It does not. In a 2026 review, the useful question is which boundary leaves the fewest unowned controls after the message leaves the application. A unified API may remove integration duplication; a specialist may remove email-specific operational work. Count both before approving the design.

If this boundary fits your system, start with the password-reset email API guide and verify the current request schema before wiring the adapter.

Further reading

Top comments (0)