Self-Host Guide · MIT License
Self-host open-source email for AI agents.
Every piece of AgentMail — the Cloudflare Worker API, Durable Object rate/lock guards, remote MCP server, real-time AI spam filter, and Preact dashboard — is 100% open source under the MIT license.
Runtime
Cloudflare Workers + Durable Objects (Deno for local dev)
Email transport
Resend outbound API + Svix-signed inbound webhook
Database
InstantDB with strict read-only client permissions
Abuse guard
Real-time Gemini spam/phishing classifier + SSRF checks
Deploy on your own domain
git clone https://github.com/uriva/agentmail.git
cd agentmail
cp .env.example .env
# Typecheck & run all tests
deno task check && deno task test
# Run locally
deno task dev # API on :8000
deno task dev:web # UI on :3000
# Deploy to your own Cloudflare Workers account
deno task build:web
deno task deploySet EMAIL_DOMAIN in .env and point your Resend inbound webhook to POST /inbound. Full environment variable list is in README.md.
Want to skip DNS, Resend & warmup ops?
Use hosted @theagentmail.net — 1 mailbox free for 30 days, then $1/mo flat.