Prompt
how to set up transactional email for a new app
Latest observation
Here’s a practical way to set up transactional email for a new app.
1) Pick an email provider
Use a service built for app emails, not a normal mailbox provider.
Common options:
- Postmark — great deliverability, simple setup, focused on transactional email
- SendGrid — flexible, widely used
- Amazon SES — low cost, more setup
- Mailgun — good API and tooling
- Resend — modern dev experience, easy integration
If you want the easiest reliable start, Postmark or Resend are often the smoothest.
2) Verify your domain
Set up your sending domain so emails don’t go to spam.
You’ll usually add DNS records for:
- SPF
- DKIM
- DMARC
Your provider will give you the exact DNS values to add at your domain registrar or DNS host.
Typical example:
SPFauthorizes the provider to send on your behalfDKIMsigns emails cryptographicallyDMARCtells inboxes how to handle unauthenticated mail
3) Use a sending subdomain
Good practice:
- Main site:
example.com - Email sending domain:
mail.example.comornotify.example.com
This keeps transactional mail separate from marketing mail and protects your main domain reputation.
4) Create a “from” identity
Set:
- From name: e.g.
Your App - From email: e.g.
noreply@mail.example.comorsupport@mail.example.com - Reply-to: if you want replies to go somewhere monitored
For transactional email, it’s common to use:
noreply@...for automated messagessupport@...orhelp@...if you want users to reply
5) Build your email templates
You’ll likely need templates for:
- Account verification
- Password reset
- Magic link / login code
- Receipt / invoice
- Welcome email
- Notification alerts
Keep them:
- Clear and concise
- Mobile-friendly
- Plain-text friendly
- Branded but simple
6) Integrate via API or SMTP
Most providers support both, but API is usually better.
API approach
Your app sends requests like:
- recipient email
- subject
- template ID
- variables for personalization
This is easier to track and more reliable.
SMTP approach
Works if your app already has SMTP support, but it’s often less convenient than an API.
7) Handle deliverability basics
To improve inbox placement:
- Authenticate domain with SPF/DKIM/DMARC
- Use a dedicated subdomain
- Send only to users who triggered the action
- Avoid spammy wording
- Keep HTML clean
- Include a plain-text version
- Don’t send unnecessary attachments
- Monitor bounce and complaint rates
8) Add event tracking and logs
Make sure you can see:
- sent
- delivered
- bounced
- opened
- clicked
- complained
- failed
Set up webhooks from your provider so your app can:
- mark emails as delivered
- retry failures
- update user status if an address bounces
- log support/debug info
9) Test in staging
Before production:
- Send test emails to Gmail, Outlook, Yahoo, Apple Mail
- Check spam/promotions placement
- Verify links, images, and rendering
- Test failure cases: invalid email, expired token, duplicate sends
10) Plan for production reliability
A few best practices:
- Queue email sending so it doesn’t block user actions
- Retry transient failures
- Make sends idempotent so you don’t send duplicates
- Use templates with versioning
- Separate transactional and marketing sends
Simple recommended setup for a new app
If you want a straightforward path:
- Choose Resend or Postmark
- Add a sending domain like
mail.yourapp.com - Configure SPF, DKIM, DMARC
- Create templates for signup verification and password reset
- Send emails through the provider’s API
- Add webhook handling for delivery/bounce events
- Test thoroughly before launch
Example workflow
When a user signs up:
- App creates verification token
- App enqueues email job
- Worker calls email provider API
- Provider sends email
- Webhook updates status
- User clicks link and verifies account
If you want, I can also give you:
- a provider comparison,
- a step-by-step setup for one provider,
- or example code in Node, Python, or Ruby.