Mailgod
The email marketing and outbound platform I built for QuickReel, then open-sourced.
I built QuickReel's in-house email marketing and outbound platform to replace paid SaaS for our 350K+ user list: visual automation flows, a shared reply inbox, a sales pipeline, a multi-mailbox sender pool, and an MCP server that lets AI agents run campaigns. Then I open-sourced it as Mailgod.
The problem
QuickReel is a bootstrapped AI video platform with 350K+ users, growing by roughly 15K a month. We needed email to grow MRR: convert free users to paid, win back churned users, and later run cold outbound to creators and businesses. Off-the-shelf tools had three problems:
- Price scales per contact. At 350K+ contacts, that's a serious monthly bill for a bootstrapped company.
- Replies are an afterthought. For us, a reply is the most valuable signal. Most tools dump replies into a generic inbox with no context.
- Our audience needed fine-grained deliverability control. Most users are in South Asia (IN/PK/NP/BD) and the higher-value users are elsewhere, so we needed tight control over volume, caps and sender reputation.
So I built our own. The first MVP took 2 days. Over six months it grew into a full platform: 83 commits, about 31K lines of TypeScript.
What I built
Lifecycle marketing
- Subscribers & segments: CSV import with bulk tagging, custom fields, a per-subscriber event timeline, and an AND/OR segment builder over any field, tag or engagement score.
- Templates: rich-text and HTML editors, Handlebars personalization, presets, desktop/mobile preview.
- Visual flow builder (React Flow): drag-and-drop sends, delays and branches. Flows run in-process or on Temporal for durable, crash-safe execution.
- Campaigns & scheduled jobs: batched broadcasts and cron-driven recurring sends.
Reply-first outbound
- Tokenized Reply-To: every email carries a unique
reply+<token>@address. SendGrid Inbound Parse routes each reply back to the exact subscriber, campaign and flow step. - Exit-on-reply: when someone replies, the flow stops, the subscriber is tagged
responded, and the lead goes to a human. - RFC 5322 threading: follow-ups carry proper Message-ID / In-Reply-To headers and reuse the first subject, so a sequence reads as one conversation.
- Shared inbox: prospect side panel, notes, labels, reminders, auto-reply detection, one-off replies from the same thread.
- Sales pipeline: a Kanban board (New → Contacted → Replied → Interested → Demo Booked → Won/Lost). Stages advance automatically on opens, replies and Cal.com bookings, but never move a lead backward from a stage a human set.
Deliverability infrastructure
- Sender pool: sends through multiple owned SMTP mailboxes with per-mailbox daily caps and warmup, polls each over IMAP for replies, sends follow-ups from the mailbox that started the thread, and auto-pauses and resumes unhealthy mailboxes.
- Deliberate choices: SendGrid click-tracking redirectors disabled (a bulk-mail fingerprint), mailto
List-Unsubscribe, per-subscriber frequency caps, and a global hourly rate limit, so we never blast the whole list at once. - Analytics: opens, clicks, replies and bounces, plus weekly reports that diagnose themselves (bounce-rate warnings, reply-signal analysis).
AI-agent native (MCP)
- An MCP server with 25 tools lets Claude and other agents prospect, segment, write templates, send, schedule and read analytics through the platform's REST API.
- Draft-first safety model: bulk sends only stage a draft. A single
confirm_sendtool dispatches, backed by a global kill-switch and hard recipient caps, so an agent can't blast the list by accident. - An agent can schedule a multi-week send plan and go offline. Scheduled sends fire server-side with an exactly-once claim.
Engineering highlights
- Correct under concurrency. Replaced a read-then-write frequency-cap check with an atomic reservation, and a per-process rate limiter with a MongoDB-backed limiter shared across instances, so multiple Cloud Run instances can't overshoot limits.
- Idempotent webhooks. SendGrid event dedupe uses a partial unique index on
sg_event_id. Stage transitions are atomic, with the forward-only rule built into the update filter, so concurrent events always end on the furthest stage. - Tests that paid for themselves. An integration suite (Vitest + in-memory MongoDB + Supertest; 46 tests) caught a production bug on its first run: a sparse unique index on a field defaulting to
nullmade every send after the first fail as a "duplicate". - Production ops. App on Cloud Run, Temporal worker on Compute Engine, deploys through Cloud Build. Diagnosed and fixed a deploy outage caused by orphaned images filling the worker VM's disk, and added pruning that's safe for running containers.
- AI-assisted engineering. For bigger features I ran multi-agent adversarial code reviews: find, independently verify, fix only confirmed findings. One 54-agent pass produced 40 confirmed issues, all fixed before shipping.
Open-sourcing it
- Clean public repo: fresh git history; production credentials, company branding and internal integrations removed; company-specific fields made generic.
- Secure defaults for strangers: refuses to boot in production with default secrets, constant-time login comparison with brute-force throttling, and a configurable brand name and postal address in email footers (CAN-SPAM).
- Ready to use: one-command Docker setup, full documentation, MIT license, and a landing page.
Impact
- Replaced per-contact SaaS pricing for a 350K+ user list with infrastructure we own.
- Made our outbound agent-operable: AI agents run prospecting and follow-up end to end through MCP, with human approval before anything sends.
- Gave it away: MIT-licensed so other bootstrapped teams can own their email stack.