Prompt
I’m building a marketplace and we send a lot of operational email to buyers and sellers. We need templates, per-message tracking, retries, and decent deliverability. What email setup would you recommend?
Latest observation
For a marketplace with operational email, I’d recommend a setup built around a dedicated transactional email provider, a template system in your app, and strong event tracking.
Recommended approach
1. Use a transactional email provider
Good options:
- Postmark — excellent deliverability, simple API, great for transactional email
- SendGrid — flexible, widely used, more features
- Mailgun — good API and routing options
- AWS SES — cheapest at scale, but more DIY
My default recommendation: Postmark if your priority is deliverability and reliability over extensive marketing features.
2. Separate operational email from marketing email
Keep:
- Transactional/operational emails: receipts, order updates, verification, dispute notices, payout notifications
- Marketing emails: newsletters, promotions, win-back campaigns
Use:
- separate domains or subdomains
- separate sending streams/accounts if possible
- separate IPs if volume is high
Example:
notifications.yourdomain.comfor ops emailnews.yourdomain.comfor marketing
This protects deliverability for critical emails.
3. Use templated emails with versioning
Store templates in code or a template service:
- subject
- HTML body
- plain-text fallback
- localization strings
- version number
Best practice:
- render templates server-side
- keep business logic out of the email layer
- include a template ID and version in every send record
That makes it easier to test, audit, and roll back.
4. Log every message with a unique internal ID
For each email, store:
- internal message ID
- recipient
- template ID/version
- related business object ID
- provider message ID
- send status
- retry count
- timestamps
- event history: sent, delivered, bounced, opened, clicked, complained
This is essential for support, debugging, and compliance.
5. Implement retries carefully
Retry only on transient failures:
- 4xx provider/API errors
- timeouts
- temporary SMTP/provider issues
Do not retry hard failures:
- invalid address
- permanent bounce
- suppressed address
- complaint/unsubscribed
Use:
- exponential backoff
- max retry count
- idempotency keys so you don’t send duplicates
6. Track deliverability events via webhooks
Make sure your provider sends webhooks for:
- accepted/sent
- delivered
- bounce
- spam complaint
- opened/clicked if you want engagement tracking
- unsubscribe, if applicable
Pipe those events into your database or event pipeline and update message status.
7. Use a queue for sending
Don’t send emails inline from request handlers.
Flow:
- app creates email job
- job goes to queue
- worker renders template and sends
- worker records provider response
- webhook updates final status
This gives you:
- retries
- rate limiting
- failure isolation
- better observability
8. Set up authentication and DNS properly
Minimum:
- SPF
- DKIM
- DMARC
Also consider:
- a branded sending domain
- reverse DNS if using your own IPs
- aligned “From” domain and DKIM domain
This is critical for inbox placement.
9. Build unsubscribe/preferences only where needed
Operational email usually doesn’t need an unsubscribe link if it’s purely transactional, but make sure you:
- distinguish transactional from marketing clearly
- don’t mix marketing content into transactional messages
- offer notification preferences for non-critical alerts where appropriate
A practical stack
If I were designing this for a marketplace:
- Provider: Postmark
- Queue: Sidekiq, Celery, BullMQ, SQS, or similar
- Template engine: your app’s templating system or provider templates
- DB table:
email_messages - Event ingestion: provider webhooks
- DNS/auth: SPF, DKIM, DMARC on
notifications.yourdomain.com
If you want a simple decision rule
- Need best inboxing + simplicity: Postmark
- Need lots of flexibility and integrations: SendGrid
- Need low cost at high volume: AWS SES
- Need advanced routing / logs / control: Mailgun
If you want, I can also sketch:
- a reference architecture,
- a database schema for email tracking, or
- a provider comparison specifically for marketplace ops email.