An email API can make a welcome message easy to send while leaving the platform team with an expensive evidence problem once that message carries a generated student report. TL;DR: choose a transactional email API by its ability to satisfy your attachment and compliance evidence requirements, then compare integration effort; a short send request is useful only after the approved recipient, report version, processor boundary, and delivery evidence have explicit owners.
Evidence comes first.
Consider a bounded production exercise, not an account of a measured incident: a new guardian account triggers a welcome email, and a background job generates the student's report as an attachment. The report finishes after the account's contact details change. The worker still holds the original recipient. A successful send would tell us little about whether that recipient remained authorized to receive that particular document.
The lesson is uncomfortable because it survives a vendor migration. The invariant is that authorization must bind a specific recipient to a specific report version at dispatch, with evidence that survives retries. An API can accept the message correctly while the application makes the wrong disclosure decision. That is the failure this design review should prevent.
What evidence should a welcome email API preserve?
Start with the question an incident reviewer would ask: which approved document went to which approved recipient, under which decision? A provider message identifier helps correlate a submission, but it cannot supply the missing authorization decision. The application should record that decision before handing the report to an external processor, and its retention policy should explain how long the record is necessary without copying the report itself into routine logs.
For this exercise, use synthetic identifiers such as report-042, revision-3, and guardian-017; these are application records, not proposed provider request fields. The evidence record should connect those identifiers with the recipient authorization revision, the dispatch decision, and any provider identifier subsequently returned. A checksum can help distinguish report bytes, but it does not prove permission to disclose them. Neither does a timestamp alone.
Keep those distinctions explicit.
SPF addresses a different question: RFC 7208 specifies checks on whether a host is authorized to use a domain in the relevant SMTP identities. It does not authorize a guardian to receive a student's report, establish the processor's jurisdiction, or certify attachment handling. Treating sender authentication as the compliance evidence for the whole workflow leaves the most consequential decision outside the audit trail.
Procurement therefore needs its own gate. Obtain contractual and technical evidence for the intended processing region, retention, deletion, subprocessors, and access controls before approving student data. If domestic processing is mandatory, require evidence for the actual email processor and region; a broad platform description is insufficient. No product in the comparison below receives a blanket compliance endorsement.
Buy versus build starts with the evidence boundary
The useful comparison is between managed delivery plus application-owned authorization, and operating more of the delivery system yourself. Building a mail service does not remove the need to prove recipient authorization. It adds another operating responsibility to a platform roadmap that already includes report generation, account lifecycle changes, and support requests.
| Option | Buy versus build allocation | Evidence and operational trade-off |
|---|---|---|
| Amazon SES | Buy sending infrastructure; build the application evidence ledger and connect delivery events to it. | Its developer guide documents attachments and event publishing. Evaluate the required event configuration and the team's ability to operate the surrounding workflow. |
| Twilio SendGrid | Buy its Mail Send API; build authorization checks and correlation around submissions. | Its documentation covers attachments and an Event Webhook. Receiving provider events still requires an application decision about authentication, retention, and reconciliation. |
| Postmark | Buy a transactional email service; build the report approval and dispatch boundary. | Its email API documents attachments, and its webhook documentation describes delivery feedback. Check attachment requirements against the generated reports before committing to the integration. |
| Unified REST platform | Buy a shared interface across capabilities; retain the evidence ledger in the application. | Public discovery with schemas and runnable examples helps assess the sending contract. Personalized transactional email fits the welcome message around the report. Verify attachment requirements and processor evidence before choosing this approach. |
| Self-operated mail delivery | Build and operate the delivery infrastructure as well as the application controls. | This gives the team responsibility for the sending path and its evidence collection. Accept it only when control requirements justify the capacity and on-call commitment. |
These are viable starting points for different teams, not interchangeable compliance packages. SES is a candidate when the team wants to assemble the surrounding delivery workflow; SendGrid and Postmark deserve evaluation when their documented attachment and event surfaces align with the evidence design. A unified interface earns its place when reducing integration work across capabilities matters and the specific sending workflow passes the same acceptance tests.
Infrai combines a self-describing REST API with one key, one wallet, one bill across 295 routes / 20 modules. Public discovery provides request and response schemas and runnable examples, so wiring a capability starts with reading its definition rather than learning a new SDK. The shared API key and unified billing provide a separate operational advantage: the report workflow can use storage, scheduling, observability, and email without provisioning a separate service credential for each integration or reconciling separate invoices for those capabilities. This broad backend coverage reduces credential provisioning and invoice reconciliation work; each capability still needs its own suitability review. The trade-off is concentrating credential management: the application still needs an explicit owner for that key and its rotation. This is a reason to evaluate the shared interface, not evidence that its processor contract meets a school's requirements.
The supplied schemas must settle attachment support, encoding, and limits before implementation. Personalized content alone isn't evidence of attachment support. Don't infer a document-transfer contract from a convenient email example.
Budget the queue and the reconciliation lag
Capacity planning should include evidence processing, not just outgoing requests. As a hypothetical planning case, 6,000 new accounts arriving over 10 minutes require an average of 10 welcome-message dispatches per second, before retries or delayed reports are included. This is arithmetic for sizing a test, not a throughput claim about any service.
Reports change the shape of that load. Generation can finish in bursts, attachment sizes affect the transfer workload, and retries keep old work alive while new accounts arrive. Measure those distributions in acceptance testing rather than assuming the average arrival rate describes the worker's peak demand.
Use separate SLOs for dispatch readiness and evidence freshness. For example, the team could propose a target that 99% of authorized, completed reports reach a submission decision within 5 minutes, while separately specifying how quickly delivery evidence must appear in its ledger. These are design targets requiring validation. Provider acceptance is not inbox delivery.
Choose the event acquisition model explicitly. If the contract uses polling, include polling volume, reconciliation lag, and cursor recovery in the capacity budget; if it uses webhooks, include receiver availability and event replay handling. A requirement for immediate cross-channel orchestration, hosted email OTP, SMTP relay, or additional messaging channels should trigger a separate capability review. Likewise, approve scheduled report dispatch only after its cancellation semantics meet the account-change policy. These are acceptance conditions, not details to discover during an incident.
Put the preventative check before dispatch
The preventative path begins before dispatch code is written: inspect the platform's discovery response, then review the sending capability's schema against the attachment and evidence requirements. This Go program performs that read without sending student information. Set INFRAI_API_ORIGIN to the platform's documented HTTPS API origin, without a trailing slash or version path; set INFRAI_API_KEY through your secret manager. Public discovery does not require authentication, but the example shows environment-based Bearer authentication for an authenticated evaluation environment.
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"os"
"strconv"
"strings"
"time"
)
func run() error {
origin := os.Getenv("INFRAI_API_ORIGIN")
u, err := url.Parse(origin)
if err != nil || u.Scheme != "https" || u.Host == "" ||
u.User != nil || u.Path != "" || u.RawQuery != "" || u.Fragment != "" {
return fmt.Errorf("set INFRAI_API_ORIGIN to the documented HTTPS origin")
}
key := os.Getenv("INFRAI_API_KEY")
if key == "" {
return fmt.Errorf("INFRAI_API_KEY is required for this example")
}
client := &http.Client{
Timeout: 20 * time.Second,
CheckRedirect: func(*http.Request, []*http.Request) error {
return http.ErrUseLastResponse
},
}
for attempt := 0; attempt < 4; attempt++ {
req, err := http.NewRequest(http.MethodGet, origin+"/v1/discovery", nil)
if err != nil {
return err
}
req.Header.Set("Authorization", "Bearer "+key)
resp, err := client.Do(req)
if err != nil {
return err
}
body, readErr := io.ReadAll(io.LimitReader(resp.Body, 8<<20))
resp.Body.Close()
if readErr != nil {
return readErr
}
if resp.StatusCode == http.StatusTooManyRequests && attempt < 3 {
delay := time.Second * time.Duration(1<<attempt)
retry := strings.TrimSpace(resp.Header.Get("Retry-After"))
if seconds, err := strconv.Atoi(retry); err == nil && seconds >= 0 {
if d := time.Duration(seconds) * time.Second; d > delay {
delay = d
}
} else if date, err := http.ParseTime(retry); err == nil {
if d := time.Until(date); d > delay {
delay = d
}
}
time.Sleep(delay)
continue
}
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return fmt.Errorf("discovery status %d: %s", resp.StatusCode, body)
}
if !json.Valid(body) {
return fmt.Errorf("discovery returned invalid JSON")
}
fmt.Println(string(body))
return nil
}
return fmt.Errorf("discovery retry budget exhausted")
}
func main() {
if err := run(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
The read uses a finite retry budget and honors rate-limit backoff; it makes no write, so it needs no dispatch idempotency key. Review the returned schemas before constructing a send request. Discovery reduces guesswork about the interface, but it cannot approve a recipient or replace processor evidence.
In the application gate, approval revision 7 must not authorize a dispatch evaluated against revision 8. In a real worker, reading the current revision and committing the dispatch decision need a consistency boundary, such as a database transaction with suitable concurrency control; a check followed by an unrelated send leaves an account-change race open. Define the point at which authorization becomes binding, and make support staff able to find that decision without opening the attachment.
Retries introduce another boundary. Give the logical dispatch a stable identity tied to the approved report and recipient decision, persist it durably, and use the selected provider's documented idempotency mechanism where available. If a timeout leaves acceptance uncertain, reconcile it before creating a fresh send. A local boolean or an in-memory map cannot establish durable deduplication across worker restarts.
That work costs engineering time. It is also work a shorter SDK initialization cannot eliminate.
When should this design change?
For a welcome email containing only a greeting, this attachment evidence boundary is disproportionate; assess the smaller workflow on its own terms. At the other extreme, if policy prohibits distributing student reports as email attachments, stop the attachment design and evaluate authenticated report access instead.
For the middle case, make the purchase decision after an acceptance exercise proves recipient binding, documented attachment handling, retry behavior, and evidence reconciliation under the projected burst. Prefer the managed service that passes those tests with an on-call burden the platform team can sustain. Integration simplicity matters, but the useful simplicity is a workflow whose decisions can still be explained after the worker has retried and the account has changed.
Sources
References for sender authentication and the competing services' documented attachment and event interfaces:
- RFC 7208, Sender Policy Framework: https://datatracker.ietf.org/doc/html/rfc7208
- Amazon SES, attachments: https://docs.aws.amazon.com/ses/latest/dg/attachments.html
- Amazon SES, event publishing: https://docs.aws.amazon.com/ses/latest/dg/monitor-using-event-publishing.html
- Twilio SendGrid, Mail Send API: https://www.twilio.com/docs/sendgrid/api-reference/mail-send/mail-send
- Twilio SendGrid, Event Webhook: https://www.twilio.com/docs/sendgrid/for-developers/tracking-events/event
- Postmark, Email API: https://postmarkapp.com/developer/api/email-api
- Postmark, webhooks: https://postmarkapp.com/developer/webhooks/webhooks-overview
Top comments (0)