All your mailboxes,
on your own server
Sync Gmail, Outlook, iCloud, QQ, 163 and company mail into a server you own. Read, write and organize everything in one web app, and give AI agents safe access through MCP and a REST API.
DaMail sounds like “dame” (だめ), Japanese for “nope”: no mail leaves without your OK.
docker compose pull && docker compose up -dWorks with the mail you already use, and any IMAP server
Just ask your inbox
The AI assistant lives in the corner of the web app. It searches mail, reads threads and checks stats and reports on its own, then answers with every point linked to the email it came from.
- Does the digging
Searches, reads messages and whole threads, and checks stats and daily or weekly reports — several steps behind one question.
- Answers with sources
Cited emails are listed under each answer. One click opens the original.
- Knows what you are reading
Attach the email you have open and ask “what do I need to do here?”, or have it draft a reply.
- Drafts, never sends
Anything it writes goes to the approval queue. It cannot send, flag or move mail.
- Your choice of model
Claude or any OpenAI-compatible API, including local Ollama, with adjustable thinking effort. Conversations stay on your server.
Let agents read your mail, with you in control of every step
DaMail ships with an MCP server and a REST API. AI assistants like Claude Duet, ChatGPT dots, Grok Bot and Meta Muse, plus clients like Claude Code and Cursor, can search, read, organize and draft replies — within the permissions and mailboxes you choose.
- Scoped permissions
Five levels — read, organize, draft, send, automation. Agents never even see tools they are not allowed to use.
- Limited to chosen mailboxes
Each API key or OAuth grant only reaches the mailboxes you pick.
- Approval before sending
Mail written by an agent lands in “Pending approval” for you to edit and send, with an undo window after that.
- Mail is untrusted input
Prompts and MCP instructions treat message bodies as data and never follow instructions inside them.
Find today’s emails that need a reply from me and draft replies for my approval.
search_emailsis:needs-reply after:today2 foundget_threadthread #1842Thread loadedcreate_draftreply → Emma WangSubmitted for your approvalsend_draftDame! No send permission — the agent cannot even see this tool
claude mcp add --transport http damail \
https://mail.example.com/mcp \
--header "Authorization: Bearer dm_xxx"{
"mcpServers": {
"damail": {
"type": "http",
"url": "https://mail.example.com/mcp",
"headers": { "Authorization": "Bearer dm_xxx" }
}
}
}Everything one person needs to run every inbox
Real-time sync
IMAP IDLE brings new mail in within a second. Read, starred and deleted states sync both ways, with automatic reconnects and resumable backfill.
AI triage and labels
Categorize, prioritize and flag mail that needs a reply, with summaries and extracted codes, bills, tracking numbers and to-dos.
Inbox rules
Combine sender, subject and AI conditions to notify, mark, archive or draft replies automatically — and dry-run before saving.
Notifications
Bark, WeCom, DingTalk, Feishu, Telegram and custom webhooks. Verification codes go straight to your phone.
Reports and analytics
Daily and weekly digests of volume, replies due and important mail, plus trends, heatmaps and top senders.
AI search
Describe what you are looking for, like “last month’s cloud invoice”, and AI turns it into filters and synonyms, then picks the matches.
Compose and organize
Rich-text compose, signatures, undo send and scheduled send. Archive, move and flags are written back to your mail server.
Bilingual
Correct decoding of legacy encodings, CJK full-text search, and a UI in English and Simplified Chinese.
Unsubscribe from what you never read
DaMail finds promotions, newsletters and mailing lists and groups them by sender with counts and open rates. The ones you ignore stand out, and one-click unsubscribe works without opening their website.
- Find dead weight by open rate
See how much each sender sent and how much you read over 30, 90 or 180 days. Three or more emails with under 20% opened land in “Rarely opened”.
- One click, no website
RFC 8058 requests are sent by your server — no cookies, no redirects, and never to private addresses.
- Every unsubscribe method
Email-only senders get an unsubscribe email from the receiving mailbox, with undo. Page-only or in-body links are found and opened for you.
- Agents can tidy up too
Ask your agent “which subscriptions do I never read?” and have it unsubscribe once you confirm. Every unsubscribe is audited.
Self-hosted, with no third party in between
Encrypted credentials
Mailbox passwords are encrypted with AES-256-GCM in your own database, under a master key only you hold.
Safe rendering
HTML mail is sanitized and rendered in a script-free sandbox, with remote images blocked by default to stop tracking pixels.
AI on your terms
AI features are off by default, can be enabled per mailbox, and work with local models such as Ollama.
Up and running in three steps
- 1Configure
Download docker-compose.yml and the example .env, then set a master key and your public URL.
- 2Start
Pull the image and start it. Database migrations run automatically.
- 3Add mailboxes
Open the web app, create an admin, add your mailboxes and create an API key for your agent.
curl -O https://raw.githubusercontent.com/gopkg-dev/damail/main/docker-compose.yml
curl -o .env https://raw.githubusercontent.com/gopkg-dev/damail/main/.env.example
# Generate a master key and put it in .env as MASTER_KEY
openssl rand -hex 32
# Pull the image and start
docker compose pull && docker compose up -d