Transactional emailUpdated · 6 min read

Transactional Email for SaaS: The Practical Guide

A field guide to transactional email for SaaS: subdomain isolation, idempotency keys, webhook suppression, and the four production bugs every v1 ships.

MT
Mailbase Team
transactional email for SaaS
On this page · 8 sections

Overview

A user clicks 'Reset password', stares at their inbox for ninety seconds, clicks it three more times, and closes the tab. Nobody files a bug report for a missing email — they just churn. Yet in most SaaS codebases, transactional email starts as a single await sendEmail(...) pasted inside a signup controller and never gets touched again until something breaks in production.

This guide covers the exact architecture decisions that separate fragile v1 email glue from a transactional pipeline you never have to think about at 2 a.m.

The four transactional email bugs almost every v1 ships

**1. Sending inside a database transaction.** If your signup route calls the email API before committing the row, a slow email request holds a DB lock — and if the transaction rolls back, the user still receives a 'Welcome!' email for an account that does not exist. Always commit first, then enqueue or fire the send asynchronously.

**2. Retrying without an idempotency key.** Stripe replays a invoice.paid webhook, or your background worker restarts right after the HTTP POST succeeded but before it wrote sent_at. Without an Idempotency-Key header (for example receipt:${invoiceId}), your customer gets two identical receipts.

**3. Ignoring hard bounces and spam complaints.** Sending another weekly alert to an address that already returned 550 User unknown slowly drags your domain reputation down across every inbox. Wire your provider's bounce and complaint webhooks into a suppression table on day one — see bounce management.

**4. Sharing a domain with marketing or outbound.** One noisy product announcement or cold campaign on your root domain can put password resets into Gmail Spam. Keep transactional and marketing email on separate subdomains (mail.yourdomain.com vs news.yourdomain.com).

  • Commit DB state first; never hold a database transaction open across an HTTP email call
  • Derive deterministic Idempotency-Key values from domain IDs (reset:${tokenId}, receipt:${invoiceId})
  • Auto-suppress hard bounces and spam complaints via signed webhooks before your first 1,000 users
  • Always include a clean plain-text text body alongside html — spam filters and watch previews rely on it

DNS setup and picking a sending layer

Before sending a single production message, authenticate your sending subdomain with SPF, DKIM, and DMARC and verify the records live using our free domain check. Start DMARC at p=none with an aggregate reporting address (rua=) so you can verify 100% alignment before moving to p=quarantine or p=reject.

For the sending layer itself, weigh developer ergonomics against monthly volume cost (and check email API vs SMTP for the transport decision). Postmark and Resend are strong defaults if you want official SDKs or SMTP; Amazon SES is cheapest raw if you want to build suppression and logging yourself. Mailbase sits in the sweet spot for REST backends: Amazon SES in Ireland (eu-west-1) wrapped in a clean JSON endpoint (POST /api/v1/send) with transactional: true, Idempotency-Key, per-recipient event lookups (GET /api/v1/events), signed webhooks, and automatic bounce suppression. You get 3,000 emails/month free on your own domain once a card is verified, then €9/month billed yearly for 50,000 emails. Follow the transactional quickstart to test a real send in five minutes.

  • Verify SPF, DKIM, and DMARC alignment on your transactional subdomain before launch
  • Store the provider message ID next to your event log so support can trace any missing email in seconds
  • Separate urgent auth mail (resets, OTPs) from heavy digests so a burst never queues behind a batch

Common mistakes

  • Sending product-critical mail and marketing from the same domain/reputation.
  • Skipping idempotency, so retries create duplicate sends.
  • Ignoring bounce and complaint webhooks until suppression breaks.
  • Treating an email API as “fire and forget” with no event logging.

Sources and further reading

Official docs for current setup details, pricing, and API behavior — verify specifics there, since they change.

Related guides

More on transactional email for saas and the surrounding transactional email workflow:

Questions

About this page.

What counts as transactional email in a SaaS?
Any one-to-one message triggered directly by a user or system event that the recipient expects immediately: password resets, magic links, 2FA codes, invoices, team invitations, and security alerts.
How do I stop my SaaS from sending duplicate receipts or password resets?
Send a deterministic Idempotency-Key (like invoice:${id}) on every POST /api/v1/send request. If your worker retries after a network timeout or a webhook fires twice, the API returns the original response instead of mailing the user again.
Should I put transactional email on a subdomain?
Yes. Using a dedicated subdomain like mail.yourdomain.com or auth.yourdomain.com isolates your product email's reputation from newsletters, marketing blasts, or outbound sales.
What is the best transactional email API for a growing SaaS?
It depends on your stack and volume: Resend for official SDKs and React Email, Postmark for dedicated transactional streams, raw Amazon SES if you want to run the event pipeline yourself, or Mailbase for a clean REST API on EU SES starting at €9/month billed yearly for 50,000 emails.