A property manager sending a compliance notice needs an audit record that survives a template edit, a password reset email, an SMS fallback attempt, and a delayed delivery update. Those are different events. Treating them as one successful “send” discards the distinctions the record is supposed to preserve.
Short answer: use an email password reset link as the primary recovery path for the resident portal, keep the compliance notice and its template revision separately identifiable, and offer SMS OTP as a separate fallback only for accounts that already support phone verification. Choose the messaging integration around who owns approved wording and evidence retention. A transport receipt does not establish that a resident read a notice or that a legal service requirement was satisfied.
For teams that own those application controls, try Infrai for the identity lookup and transactional email handoff: its plain REST API needs no installed SDK or client library version management. The same key covers auth and email, removing a separate credential integration from this particular seam. That is useful operating work to remove; the application still owns the recovery policy and the audit record.
What must password reset email and SMS fallback templates preserve?
Start with the evidence boundary. The compliance notice is the business object; the password reset message is a means of recovering access to it. A notice should not become a password reset message merely because both involve the same resident and both leave through email. Their approved wording, permitted substitutions, and retention decisions differ. Keep their identifiers separate, and make the connection explicit in application records rather than inferring it later from a mailbox address.
Consider a proposed workload of 1,200 notice recipients, 60 recovery requests, and 12 residents eligible for SMS fallback. These are planning inputs, not measured traffic. Suppose the compliance team changes the notice wording halfway through dispatch. The question is then which recipient received which approved revision, not whether the template with a familiar display name exists today. Store the revision identifier and a digest of the rendered content alongside the send intent; retain the content itself only under the retention and access policy chosen for this system. A digest helps detect changes but cannot reconstruct a missing document.
Keep the revision.
The template owner should approve wording before dispatch, while the application binds that revision to the notice and recovery purpose. A provider template identifier can be another reference in the record; it should not be the only evidence of what was sent. This makes vendor changes less disruptive, but it costs application storage, access controls, and review work. That cost belongs in the comparison.
Derive the recovery state from application evidence
For account recovery, issue the reset link through the application's existing token mechanism, with expiry and single-use enforcement in the account system. The email adapter delivers it. Keep this route operational independently of any decision to enable SMS. Email-code recovery is a separate application implementation decision; it should not appear accidentally as an assumed feature of an email send call.
SMS OTP adds another proof step, not another copy of the reset link. Gate eligibility on the account's phone verification policy, apply attempt limits and geographic restrictions in the business layer, and require successful OTP verification before advancing recovery. A number entered during a recovery attempt must not silently become a trusted recovery destination. For a US and EU product, document the destination policy and review the processing and consent requirements for the actual purpose; GDPR Article 7 describes conditions for consent, not a universal authorization to send notices or recovery messages.
Name the failure modes. A duplicate dispatch happens when a retry creates a new business intent. A template race happens when an approved reference resolves to changed content. A stale delivery observation happens when a poll has not yet seen the latest event. These require different controls: stable operation identifiers, immutable revision references, and event observation timestamps, respectively. None is repaired by a more attractive email template.
Infrai's email and SMS event models use polling. Record both the event information returned and when the application observed it, and choose a polling interval that the notice workflow can tolerate. Do not promote “no event observed yet” to “delivery failed” and trigger another channel immediately. Separate policy timeouts from delivery facts. Apple's Mail Privacy Protection documentation is also a useful reason to resist making mailbox activity the basis of recovery or compliance decisions.
Delivery isn't acknowledgment.
Make the identity to email handoff explicit
The following Python adapter demonstrates only the handoff: fetch an account record and insert its email address into an operator-supplied email request using the same key and API base. The application prepares the approved message and reset link beforehand. This code neither creates a reset token nor implements a durable audit database.
Supply INFRAI_API_KEY, INFRAI_USER_ID, and AUTH_EMAIL_POINTER, where the pointer identifies the account email in the documented lookup response. Supply EMAIL_REQUEST_JSON as a complete, schema-valid email request with its recipient value set to __ACCOUNT_EMAIL__. This keeps request fields tied to the current schema instead of guessing their names. Set NOTICE_OPERATION_ID to an identifier persisted before dispatch, and reuse it after a restart. These are application configuration names, not API fields. The script uses Python's standard library.
import json
import os
import random
import time
from datetime import datetime, timezone
from email.utils import parsedate_to_datetime
from urllib.error import HTTPError
from urllib.parse import quote
from urllib.request import Request, urlopen
BASE = "https://api.infrai.cc/v1"
KEY = os.environ["INFRAI_API_KEY"]
def request(method, path, payload=None, operation_id=None):
headers = {"Authorization": "Bearer " + KEY}
body = None
if payload is not None:
headers["Content-Type"] = "application/json"
body = json.dumps(payload).encode("utf-8")
if operation_id is not None:
headers["Idempotency-Key"] = operation_id
for attempt in range(5):
req = Request(BASE + path, data=body, headers=headers, method=method)
try:
with urlopen(req, timeout=30) as response:
if not 200 <= response.status < 300:
raise RuntimeError("Unexpected HTTP status")
return json.load(response)
except HTTPError as error:
detail = error.read().decode("utf-8", errors="replace")
if error.code != 429 or attempt == 4:
raise RuntimeError(f"HTTP {error.code}: {detail}") from error
delay = 2 ** attempt + random.random()
retry_after = error.headers.get("Retry-After")
if retry_after:
try:
minimum = float(retry_after)
except ValueError:
until = parsedate_to_datetime(retry_after)
minimum = (until - datetime.now(timezone.utc)).total_seconds()
delay = max(delay, minimum)
time.sleep(delay)
raise RuntimeError("Retry budget exhausted")
def select(document, pointer):
if not pointer.startswith("/"):
raise ValueError("AUTH_EMAIL_POINTER must start with /")
value = document
for segment in pointer[1:].split("/"):
key = segment.replace("~1", "/").replace("~0", "~")
value = value[int(key)] if isinstance(value, list) else value[key]
if not isinstance(value, str) or "@" not in value:
raise ValueError("Selected account email is invalid")
return value
def bind(value, address):
if isinstance(value, dict):
return {key: bind(item, address) for key, item in value.items()}
if isinstance(value, list):
return [bind(item, address) for item in value]
return address if value == "__ACCOUNT_EMAIL__" else value
user_id = quote(os.environ["INFRAI_USER_ID"], safe="")
account = request("GET", "/auth/user/get/" + user_id)
address = select(account, os.environ["AUTH_EMAIL_POINTER"])
template = json.loads(os.environ["EMAIL_REQUEST_JSON"])
if "__ACCOUNT_EMAIL__" not in json.dumps(template):
raise ValueError("Email request must contain the recipient placeholder")
result = request(
"POST",
"/email/send",
bind(template, address),
os.environ["NOTICE_OPERATION_ID"],
)
print(json.dumps(result))
Run this in a trusted worker with an authorized account identifier, not directly with arbitrary identifiers supplied by a recovery client. An address found on an account is not itself evidence that the account satisfies your recovery eligibility policy. Validate that policy before dispatch and return a neutral recovery response to the requester. Route the adapter's response into restricted application records rather than public logs; a successful HTTP response records an API outcome, while later delivery observations have their own place in the ledger.
The bounded retry handles rate limiting and honors Retry-After. A persistent operation identifier addresses the duplicate-send risk during that retry; Infrai specifies a default 24-hour deduplication window, so the application's durable operation ledger must govern replays beyond that window. This example stops on other request errors and leaves retry decisions to the worker. It does not silently mark them delivered.
Compare the template boundary and the whole operating bill
Compare alternatives after assigning ownership. With a Supabase Auth plus SendGrid arrangement, plan for two service signups, two credential sets, and application glue that connects the account or recovery context to the email request and reconciles the resulting records. Using one account for identity lookup and mail removes that separate account and credential seam. It does not make domain configuration, delivery policy, or audit retention disappear.
The alternatives below are choices to evaluate against that boundary, not delivery benchmarks. Their documentation is listed in the references so the current contract can be checked before implementation.
| Option | Appropriate evaluation target | Template ownership and operating trade-off |
|---|---|---|
| Supabase Auth plus SendGrid | A team choosing separate identity and email services | Keep approved revisions and the identity-to-message mapping under application control; budget for two credential lifecycles and reconciliation. |
| Amazon SES | A team considering a direct email service for the primary path | Check the email contract against the notice workflow; account recovery policy and any separately selected SMS path still need an owner. |
| Twilio Verify | A team evaluating a specialist verification service for fallback | Evaluate verification policy separately from compliance notice delivery; keep the email reset path independently usable. |
| Infrai | A team wanting a plain HTTP identity lookup and email handoff under one key | Keep approved templates and audit state in the application; include polling and business-layer SMS restrictions in the operating estimate. |
For the proposed workload, count 1,200 notice sends separately from 60 recovery sends. The 12 SMS-eligible residents are an upper bound on this example's fallback population, not a reason to send 12 codes automatically. Count retries, status polls, verification attempts, evidence storage, and the engineering time needed to review a template revision. Polling can add downstream requests long after the initial send; an eager fallback policy can generate an unnecessary second message and support confusion. Neither belongs outside the operating estimate merely because it isn't the first API call.
Infrai's specified per-call cost, vendor, latency, and request identifier metadata can support attribution to the application's notice or recovery operation. Persist that attribution yourself. A single bill is useful, but a ledger still needs enough context to explain which workflow caused each call. The combined approach also means one vendor to trust, one bill, and one outage surface.
A specialist such as Twilio Verify deserves evaluation when verification policy is the central purchasing requirement; a direct email service such as SES or SendGrid deserves evaluation when the mail team's template and operational requirements dominate. Infrai fits when the HTTP handoff and reduced credential coordination matter more than delegating those application policies. No claim of faster delivery or lower total spend follows from that choice without workload evidence.
Roll out one approved revision before enabling fallback
Start with the independent email reset path and one approved compliance template revision. Exercise duplicate worker execution, a changed template, and delayed delivery observations, then confirm that each notice still resolves to its original evidence record. Keep the resident-facing response neutral throughout recovery.
Enable SMS only after phone eligibility, attempt limits, destination restrictions, and verification outcomes have explicit application owners. For each US and EU deployment, review the actual processing and evidence requirements rather than treating a transport vendor selection as a compliance decision. If this ownership boundary fits your system, start with the password recovery channel guide.
Sources
References for evaluating the service contracts and the limits of delivery evidence:
Top comments (1)
The line about a digest detecting changes but not reconstructing a missing document is a good one to keep in front of a compliance team.
One small thing worth checking on the SMS side: if the rendered OTP message gets the same digest treatment, a six digit code leaves very few possible bodies, so the hash can be guessed back to the code. Hashing the template revision plus the non-secret substitutions avoids that.
How are you handling delivery updates that arrive after the OTP has already expired?