Claude Templates / S-tier · Foundation
Infrastructure
The Email Infrastructure Playbook
Postmark, the SPF/DKIM/DMARC recipe, drip campaigns, and transactional vs marketing routing.
EMAIL-INFRASTRUCTURE-PLAYBOOK.md · 16 sections · 3,691 words · 30 KB · markdown
The sending engine. Domain authentication done right the first time, a layout system so every email looks like it came from the same company, drip campaign mechanics, and the routing rule that keeps transactional mail out of the opt-out gate.
What's inside
- //Postmark setup with per-app servers and message streams
- //The exact SPF / DKIM / DMARC DNS recipe
- //A reusable email layout + component system
- //Drip campaign schema and step-timing model
- //Transactional vs marketing routing (and why transactional bypasses opt-out)
- //Unsubscribe handling that satisfies CAN-SPAM
When to use it
Week 2, before the first lifecycle email goes out.
Build these first
Straight from the file
Reference: src/lib/email/postmark.ts — single-file client with sendPostmarkEmail, sendBroadcastEmail, sendThreadedReply, isRetryablePostmarkError.
Table of contents
- 0. Use this spec
- 1. Architecture
- 2. Postmark account setup
- 3. DNS auth (SPF + DKIM + DMARC)
- 4. Schema
- 5. Layout wrapper + marketing-only sentinels
- 6. Drip-tick worker
- 7. Trigger events + enrollment
- 8. Transactional vs marketing routing
- 9. Unsubscribe handling (HMAC + one-click)
- 10. Postmark events webhook
- 11. Inbound mail webhook
- 12. Opt-out gating (drip worker side)
- 13. Sender resolution + merge context
- 14. Common pitfalls
- 15. Kickoff prompt
How to run it
Drop EMAIL-INFRASTRUCTURE-PLAYBOOK.md into your repo, then tell Claude Code: “Read EMAIL-INFRASTRUCTURE-PLAYBOOK.md and implement it in this codebase.” It's written for an agent to execute end to end. Search the file for angle-bracket placeholders and swap in your own project names, domains, and keys before the first run.
More infrastructure playbooks
Trigger.dev Workers
The three-file pattern for anything that can't finish inside an HTTP request.
Read + download →B-tierWebhook Receiver
Receiving third-party webhooks — and sending your own — without losing events.
Read + download →B-tierScheduler Engine
One queue for every future-dated action — drips, reminders, scheduled sends.
Read + download →