Transactional email flows
Build reliable welcome emails, booking confirmations, payment receipts, and reminders with idempotent triggers and clear monthly plan quotas.
How transactional email architecture works
A reliable transactional email is never triggered directly by a browser button click. Users double-click submit buttons, refresh thank-you screens, and lose mobile signal mid-checkout — causing either duplicate emails or silently missing receipts.
Instead, every transactional email should fire strictly as a server-side side effect of a verified state change in your Cloud database or an authenticated Stripe webhook. Separating the state change from the delivery step guarantees that receipts match paid orders and never duplicate on retries.
[Verified Server Event] (e.g., Stripe checkout.session.completed or booking confirmed)
|
v
[Check Idempotency Ledger] -> Key already exists ("receipt:ord_1042")? Stop safely.
| (New key)
v
[Render Multipart Template] -> Clean HTML + plain-text fallback + local timezone
|
v
[Send via Verified Domain] -> Records delivery ID and timestamp in email_deliveriesKeeping transactional flows strictly separate from promotional newsletters also safeguards your sender reputation. High-intent receipts and booking confirmations consistently achieve high open rates, teaching Gmail and Outlook to prioritize mail from your domain.
Monthly limits and capabilities across ExaSpark plans
Every ExaSpark plan includes managed transactional email so authentication works immediately on day one. As your app graduates from early prototypes to live customer receipts and reminders, plan tiers expand monthly send quotas, custom sender domains, and log retention.
| Plan | Monthly email allowance | Allowed email types | Custom sending domains | Log retention | Behavior at monthly cap |
|---|---|---|---|---|---|
| Free ($0/mo) | 100 / month | Auth only (verification, password resets, magic links) | 0 (default ExaSpark sender) | 7 days | Pauses until next monthly cycle |
| Starter ($4.99/mo or $3.99/mo annual) | 1,000 / month | Auth + custom app emails (receipts, bookings, alerts) | 1 custom domain | 7 days | Overage allowed without blocking orders |
| Pro ($25/mo or $20/mo annual) | 10,000 / month | Auth + full custom transactional notifications | Up to 3 custom domains | 30 days | Overage allowed without blocking orders |
Core email flows every revenue app needs
Most SaaS tools, booking studios, and shops need six core transactional flows. Specify the exact trigger, dynamic fields, and unique idempotency key for each flow before building.
| Email flow | Server trigger | Essential fields | Idempotency key |
|---|---|---|---|
| Welcome | Account verified | Sign-in link, account email, first action | welcome:<user_id> |
| Booking confirmed | Deposit webhook | Service, local time + zone, venue, deposit, balance | booking_confirmed:<booking_id> |
| Stripe receipt | checkout.session.completed / invoice.paid | Order number, line items, total, Reply-To | receipt:<stripe_id> |
| 24h reminder | Hourly scheduled check | Local appointment time, directions, reschedule rule | reminder_24h:<booking_id> |
| Team invite | Admin creates invite | Inviter, workspace, role, expiring link | invite:<invite_id> |
| Failed renewal | invoice.payment_failed | Plan, grace window, Customer Portal link | dunning:<invoice_id> |
Preventing duplicate sends with idempotent triggers
Stripe webhooks use at-least-once delivery, and scheduled jobs occasionally overlap during deployments. Without idempotency guards, a single paid order can send a customer three identical receipts in ten seconds.
Create an email_deliveries table with a UNIQUE constraint on idempotency_key. Insert the key before calling the mail API; if the database rejects a duplicate key, return cleanly without sending again.
{
"id": "em_01J9Z8Q4M1",
"idempotency_key": "booking_confirmed:bkg_7402",
"template_name": "booking_confirmation",
"recipient_email": "maya@example.com",
"status": "sent",
"sent_at": "2026-11-18T16:04:12Z"
}Handling time-based reminders without drift
Never match an exact minute (slot_start == now + 24h) for appointment or trial reminders — if a job runs two minutes late, it skips the booking silently.
Run an hourly check for confirmed bookings where slot_start falls between 23 and 25 hours ahead and reminder_24h_sent_at IS NULL, recording both the timestamp and reminder_24h:<booking_id>. See Scheduled jobs & automation.
Designing templates that pass spam filters and convert
Anatomy of a high-trust transactional email
- Recognizable sender and `Reply-To`. Send from your verified domain (
Studio North <bookings@mail.studionorth.co>) with a realReply-To(hello@studionorth.co) rather thannoreply@. - Multipart HTML + plain text. Always pair clean HTML with a plain-text fallback so spam filters never penalize image-heavy templates.
- Explicit local timezones. Store UTC in Cloud, then render dates in the venue or user timezone (
Thu, Nov 19 at 2:00 PM EST). - Direct domain links only. Point every CTA straight to your verified domain (
https://studionorth.co/bookings/7402) without third-party URL shorteners. - Essential facts first. Place confirmation status, date/amount summary, and one clear button at the top without promotional banners.
Implementing your email suite step by step
Verify your sending domain
Complete SPF, DKIM & DMARC setup on Starter or Pro before enabling custom app emails.
Add an `email_deliveries` ledger
Store unique
idempotency_key,template_name,recipient_email,status, andsent_atfor auditability and deduplication.Wire server-only triggers
Fire receipts from Stripe webhooks, welcomes from auth verification, and reminders from hourly checks — never unauthenticated browser forms.
Test templates in Preview
Send every flow to personal Gmail and Outlook inboxes, checking mobile wrapping, timezones, and plain-text fallbacks.
Audit live delivery logs
Check Cloud → Email → Logs (
7 dayson Free/Starter,30 dayson Pro) during launch week to catch typos and bounces.
Build a transactional email suite backed by an `email_deliveries` table with a unique `idempotency_key` column so retries never duplicate emails. Send HTML + plain-text emails from `Studio North <bookings@mail.studionorth.co>` (`Reply-To: hello@studionorth.co`) for four server events: (1) booking confirmation on Stripe `checkout.session.completed` with local EST time, venue address, deposit paid, balance due, and manage link; (2) hourly 24-hour reminder guarded by `reminder_24h_sent_at`; (3) itemized order receipts; and (4) failed-renewal alerts on `invoice.payment_failed` linking to Stripe Customer Portal.
Troubleshooting missed, duplicated, or delayed emails
| Symptom | Most likely root cause | Reliable fix |
|---|---|---|
| Custom receipt never sent | Project is on Free (100/mo auth-only) | Upgrade to Starter (1,000/mo) or Pro (10,000/mo) |
| Duplicate receipts received | Webhook retried without an idempotency_key guard | Check unique idempotency_key in email_deliveries before sending |
| Wrong appointment hour | Server formatted raw UTC instead of local timezone | Convert UTC to venue IANA timezone (America/New_York) and show zone label |
| 24h reminder skipped slots | Job checked an exact minute instead of a window | Query slot_start between 23h and 25h ahead where reminder_24h_sent_at IS NULL |
| Log shows `Hard bounce` | Customer mistyped their email at checkout | Suppress retries to hard-bounced addresses and allow email edits on account settings |
| Mail lands in Spam | Heavy banners, missing plain text, or missing DMARC | Strip marketing bloat, add plain-text body, and verify SPF/DKIM/DMARC |