Repository avatar
AI Tools
v1.0.0
active

cloudmail

io.github.cloudmail-hq/cloudmail

Read, search, draft and send mail in your self-hosted cloudmail deployment, with held-send approval.

Documentation

cloudmail

cloudmail: business email on your own domain, in your own Cloudflare account

The Google Workspace and Outlook alternative for email.
Mailboxes for your team and your AI agents, with AI-drafted replies. Self-hosted, and paid once.

Buy a licence, from $9   Try the live demo   Visit trycloudmail.com

Deploy to Cloudflare

Live demo · Features · Pricing · For AI agents · Deploy · API docs · Compare · Video

The cloudmail inbox: a new email arrives, the AI summarises it and drafts a reply, and a person approves the send

cloudmail is a complete webmail app that you deploy into your own Cloudflare account. Mail for your domains arrives through Cloudflare Email Routing, each mailbox lives in its own private database, and attachments sit in your R2 bucket. Nothing passes through our servers. The only thing the app ever sends us is the licence check-in.

Why teams choose cloudmail

You own the mail
Every mailbox, attachment and search index is in your Cloudflare account. We never see your mail.
Paid once
$9 or $29, once. No per-seat fee, so adding a person or an agent costs nothing.
AI is built in
Summaries, triage, drafted replies and "Ask your inbox" run on Workers AI in your account, or on your own AI gateway.
Made for AI agents
Every agent gets its own mailbox. Agents work through the MCP server, the CLI, the SDKs or the REST API, and their sends wait for a person's approval by default.

What it is not

  • Not an office suite. Email only: no calendar, contacts sync, documents, drive or video calls.
  • Not an IMAP or SMTP server. Mail apps that speak Exchange ActiveSync (the iPhone and Android mail apps, Outlook for Windows, Thunderbird with an add-on) can connect with an app password, for mail only. Apps that only speak IMAP can't. The web app installs on your phone too, with push notifications.
  • Not a hosted service. It runs in your Cloudflare account, and you need one.

Screenshots

A cloudmail conversation with an AI summary above the thread
Conversations with an AI summary
Threads, labels and attachments, with the summary on top.
The cloudmail AI email assistant answering a question about the inbox and drafting a reply
An assistant that drafts replies
Ask what needs attention. It drafts, you send.
Approving an email that an AI agent asked to send
Agent sends wait for approval
See exactly what an agent wants to send, then approve, edit or reject.
Searching every mailbox at once in cloudmail
Search across every mailbox
Keyword and semantic search, with operators such as from: and has:.
Writing an email in the cloudmail composer
A full composer
Rich text, attachments, signatures, templates and scheduled send with undo.
An email sequence with steps and enrolled contacts
Email sequences
Multi-step follow-ups with enrolments and progress.
Custom email domains and sending health in cloudmail settings
All your domains in one place
Add a domain, check its DNS records and watch sending health.
Email analytics in cloudmail: opens, clicks and delivery
Analytics
Delivery, opens, clicks, DMARC reports and usage.
The cloudmail inbox in dark mode
Dark mode
Follows your system, or switch it yourself.
cloudmail on a phone: the inbox and a conversation
On your phone
Installs as an app, with push notifications.

Features

  • Webmail. Threads, folders and labels, snooze, scheduled send with a 30-second undo, search operators (from:, has:, before: …), bulk actions, a rich composer with attachments, inline images, signatures and templates.
  • Email on your own domains. As many domains as your licence allows, unlimited mailboxes, aliases and catch-alls, live SPF, DKIM and DMARC checks, and a guided setup that shows every DNS change before making it and can undo it.
  • Shared inboxes. Invites, owner, admin and per-mailbox roles, delegation and an access log.
  • AI email assistant. Summaries, a daily brief, AI triage with labels and a Screener, semantic search and Ask your inbox, and an assistant that drafts replies. Runs on Workers AI in your account, or on your own Anthropic- or OpenAI-compatible gateway.
  • Rules and replies. Filter rules, muted conversations, a vacation responder that won't answer mailing lists or loop with other responders, follow-up reminders.
  • Email sequences. Multi-step follow-ups that stop when someone replies.
  • Sending and deliverability. Cloudflare Email Service by default, or Amazon SES or Resend per domain. Suppressions, unsubscribe headers, a spam-rate circuit breaker, optional open and click tracking.
  • Security. Passwords (scrypt), passkeys, TOTP two-factor, recovery codes, Turnstile, rate limits, sandboxed message rendering with remote images blocked until you allow them.
  • Privacy. Export everything as .mbox, delete an account, retention rules, tracking opt-outs.
  • Import. Google Takeout .mbox, .eml archives, or IMAP from your old provider.
  • Phone. Installable web app with Web Push notifications.

Every setting is described in docs/reference.md.

Email for AI agents

An AI agent sends an email through the cloudmail CLI and MCP server; the send is held until a person approves it

Give every agent its own mailbox, with its own token, send rules and expiry. Agents reach cloudmail four ways:

  • MCP server. 73 tools at https://<your-host>/mcp, with OAuth sign-in. Works with Claude Code, Claude, Cursor, Codex, Gemini CLI and GitHub Copilot. Setup for each client: docs/mcp.md.
  • CLI. The cloudmail command for macOS, Linux and Windows, from the releases. Tables at a terminal, JSON in a pipe.
  • SDKs. TypeScript and Python clients in this repository, typed from the API's OpenAPI document.
  • REST API and webhooks. Idempotency keys, realtime events and signed webhooks. Reference: trycloudmail.com/docs.

Connect Claude Code to your mailbox:

claude mcp add --transport http cloudmail https://mail.example.com/mcp

Send from code with the TypeScript SDK, and handle a send that is waiting for approval:

import { Cloudmail, isPendingApproval } from "@cloudmail/sdk";

const mail = new Cloudmail({ baseUrl: "https://mail.example.com", token: process.env.CLOUDMAIL_TOKEN! });

const result = await mail.mail.send("support@example.com", {
  to: "customer@example.org",
  subject: "Your order shipped",
  markdown: "It's on the way. **Tracking:** [ZX123](https://example.com/t/ZX123)",
});
if (isPendingApproval(result)) console.log("held:", result.approval_url);

Sends from agents and API tokens wait for a person's approval by default, and an agent can't approve its own send.

cloudmail vs Google Workspace and Microsoft 365

cloudmailGoogle WorkspaceMicrosoft 365
Where your mail is storedYour Cloudflare accountGoogle's data centresMicrosoft's data centres
How you pay$9 or $29 once, plus about $5 a month to Cloudflare for the whole accountPer person, per monthPer person, per month
Mail on your own domainsYesYesYes
Shared inboxesShared mailboxes with rolesGoogle Groups and delegationShared mailboxes
AIBuilt in, on Workers AI in your account or your own gatewayGemini, depending on planCopilot, depending on plan and add-ons
Mailboxes for AI agentsA separate address per agent, with its own token and send rulesA paid seat per agent, or API access to a person's mailboxA user or shared mailbox through Microsoft Graph
Access for AI agentsMCP server, Agent Skill, CLI, SDKs and RESTGmail APIMicrosoft Graph API
Calendar, documents, callsNo, email onlyYesYes
Phone and desktop mail appsExchange ActiveSync with an app password, mail only. No IMAPYesYes
Source codeFair source, publicProprietaryProprietary
Who runs itYouGoogleMicrosoft

Full comparisons: Google Workspace, Microsoft 365 and Outlook, Fastmail, Proton Mail, Front, Help Scout, Missive, AgentMail and Mailcow.

Replacing Gmail "Send mail as"

Google removes Gmail's "Send mail as" for addresses it does not host in January 2027. If your domain forwards into Gmail through Cloudflare Email Routing, cloudmail keeps receiving there and sends from your own address through Amazon SES or Resend. What changes, and what each alternative costs.

Deploy

Deploy to Cloudflare

Deploying cloudmail to Cloudflare with one click, then the guided setup
One click to deploy
Adding a second email domain in cloudmail and verifying its DNS records
Add a domain, verify its DNS

One click to deploy, then a guided setup in the app:

  1. Deploy. The button copies this repository to your GitHub or GitLab account and creates the Worker, R2 bucket, KV namespace, Vectorize index, Durable Objects and Workers AI binding. Keep the suggested names. Fill SETUP_TOKEN and AUTH_SECRET with the output of openssl rand -base64 32 each, and keep the setup token in a password manager. Leave the rest empty.
  2. Create the owner. Open the new workers.dev address. It goes to /setup, where the setup token creates your owner account.
  3. Connect Cloudflare and activate your licence. Press Create token: the Cloudflare dashboard opens with the right permissions filled in. Paste the token back, then paste your licence key.
  4. Review and apply. Pick your domains. The app shows a plan: what it will do itself (turn on Email Routing, point the catch-all at this Worker, set up sending, add a monitor-only DMARC record), what needs your OK (anything that changes a record you already have, such as another provider's MX), and anything you must do by hand. Apply it, create a mailbox, and send it a test.

Before you start, turn on R2 once in the dashboard, and if another provider handles mail for the domain today, move your old mail first. The full guide, including a command-line deploy and a prompt for AI agents, is in docs/self-deploy.md. Problems: docs/troubleshooting.md.

Deploy with an AI agent

Paste this into an AI agent that has terminal access (Claude Code, Codex, Cursor and similar):

Install cloudmail from https://github.com/cloudmail-hq/cloudmail on my Cloudflare account.

1. Read README.md, docs/self-deploy.md and wrangler.jsonc first.
2. Ask me for my Cloudflare account ID and a deploy API token, using a secret input.
   Use them only as CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN for Wrangler.
   Never print them, commit them, write them to a tracked file, or pass them as
   command arguments.
3. Keep the Worker name exactly "cloudmail". Create the Vectorize index
   "cloudmail-semantic" if it does not exist:
   npx wrangler vectorize create cloudmail-semantic --dimensions=1024 --metric=cosine
4. Run `npm ci`, then `npm run deploy` (it also creates the R2 bucket, the KV
   namespace and the Vectorize metadata index), then `npm run secrets -- --deploy`
   to upload SETUP_TOKEN and AUTH_SECRET. Tell me the setup token it prints, once.
5. Give me the app URL. I will open /setup, create the owner account, connect
   my Cloudflare token and activate my licence in the app.

The deploy token needs Workers Scripts Edit, Workers R2 Storage Edit, Workers KV Storage Edit, Vectorize Edit and Account Settings Read on the target account. It is separate from the token you paste into the app.

Pricing

cloudmail is fair source: the code is public, and running it needs a licence key, paid once.

SoloUnlimited
Price$9 once$29 once
Domains1Unlimited
Deployments11
Mailboxes and usersUnlimitedUnlimited
UpdatesAll 1.x releasesAll 1.x releases
Buy SoloBuy Unlimited

Payments are handled by Dodo Payments. The key arrives by email. See Licence.

See pricing on trycloudmail.com

Cost and plan requirements

cloudmail has no monthly fee from us. Cloudflare bills your account directly.

The usual setup costs about $5 a month to Cloudflare for the whole account, not per user: the Workers Paid plan, which includes 3,000 sent emails a month, then $0.35 per 1,000 (Email Service pricing).

Can it run on the Workers Free plan? Partly. We deployed it on a new Free account (November 2026) and this is what we found:

Workers FreeWorkers Paid
Deploy (Worker, 7 SQLite Durable Objects, R2, KV, Vectorize + metadata index, rate limits, cron)WorksWorks
Receiving mail (Email Routing to the Worker)Works, unlimitedWorks, unlimited
Sending through Cloudflare Email SendingNo. Only to your own verified addresses. Mail to anyone else fails with E_RECIPIENT_NOT_ALLOWEDAny recipient. 3,000 a month included
Sending through your own Resend or Amazon SES accountWorks (tested). Their own pricing applies; Resend's free tier is 100 a dayWorks
CPU per request10 ms documented. Creating the owner used ~200 ms and a sign-in ~110 ms and both succeeded, but Cloudflare can enforce the limit; large messages and AI work need moreUp to 5 minutes
Daily caps100,000 requests, 100,000 Durable Object requests and rows written, 10,000 Workers AI neurons. Over them, requests fail until 00:00 UTCBilled by use beyond generous monthly allowances
R210 GB free, but R2 must be turned on in the dashboard, which can ask for a payment methodSame

So Free + Resend or SES can work for one person with light mail. For a team, or to use Cloudflare's own sending, plan on Workers Paid. Sources: Workers limits, Email Service pricing, Durable Objects pricing, Workers AI pricing, Vectorize pricing, R2 pricing.

You also need a domain on Cloudflare DNS (Cloudflare limits Email Routing to 200 rules per domain; the catch-all avoids per-address rules).

Architecture

 Internet mail ──> Cloudflare Email Routing ──catch-all──┐
                                                          v
 Browser / phone ───────────────────────────────> cloudmail Worker (Hono API + React Router SSR)
 CLI, SDKs, MCP clients ──────────────────────────>   │
                                                       ├─> MailboxDO        one SQLite database per mailbox
                                                       ├─> AuthDO           accounts, sessions, tokens, domains, licence
                                                       ├─> EmailAgent DO    the assistant (Agents SDK)
                                                       ├─> WebhookDO, EventsDO, AssistantDO, EmailMCP
                                                       ├─> R2               raw messages, attachments, exports
                                                       ├─> Vectorize        semantic search (one namespace per mailbox)
                                                       ├─> Workers AI       summaries, triage, embeddings
                                                       └─> Email Service / Amazon SES / Resend  ──> outbound mail
  • Your account, your data. Every resource above is in your Cloudflare account. Mailboxes are isolated from each other at the storage level.
  • Stack. React 19, React Router 7, Tailwind CSS 4, TanStack Query, TipTap on the front; Hono, Durable Objects (SQLite), R2, KV, Vectorize, Workers AI and the Agents SDK on the Worker.
  • Licence check-in. The only call to us: the key once at activation, then a daily refresh that sends the deployment id, host name and Cloudflare account id. See Licence.

Upgrade, back up, uninstall

  • Upgrade. Your copy of the repository gets a pull request for each release (the cloudmail update workflow); merge it and Workers Builds deploys it. Your wrangler.jsonc values and your own code changes are kept, and data migrations run by themselves. On GitLab or the command line, run npm run update. Settings → Updates shows what's new. Details: docs/upgrade.md, release notes: CHANGELOG.md.
  • Back up. Settings → Account & security → Your data → Export gives a zip with one .mbox per mailbox (every mailbox, for an admin). Do it before upgrades and on a schedule. Details.
  • Uninstall. Point your domain's mail elsewhere first, export, deactivate the licence, then delete the Worker, bucket, KV namespace and index. Checklist.

Security

  • Sign-in is built in: scrypt password hashes, passkeys, TOTP two-factor with recovery codes, per-account lockout and rate limits, optional Turnstile. Secrets (2FA, stored tokens, import passwords) are encrypted at rest under AUTH_SECRET.
  • Message bodies are sanitised and rendered in a sandboxed frame. Remote images are fetched through a signed proxy only after you allow them.
  • Agent and API-token sends are held for a person's approval by default, and an agent credential can't approve its own send.
  • The full model, including the authorization rules and inbound-mail trust, is in docs/reference.md. An incident checklist for operators is in docs/security/breach-runbook.md.

Reporting a vulnerability. Please don't open a public issue. Use GitHub's Report a vulnerability button on the Security tab, or email security@trycloudmail.com. We reply within three working days and credit reporters who want it.

Questions

Is cloudmail a Google Workspace or Microsoft 365 alternative? For email, yes: mailboxes on your own domains, shared inboxes, search and a phone app. It has no calendar, documents or calls.

Where is my mail stored? In your Cloudflare account: one database per mailbox, and attachments in your R2 bucket.

What does it cost to run? The licence is $9 or $29 once. Cloudflare bills you about $5 a month for the whole account, however many people use it. See Cost and plan requirements.

Can I read my mail in Outlook or Apple Mail? Yes, in apps that support Exchange ActiveSync: the iPhone and Android mail apps, and Outlook for Windows. Make an app password at Settings → Account & security → App passwords and add an Exchange account with it. Mail only: no calendar or contacts. There is no IMAP, so apps that only speak IMAP can't connect.

Can an AI agent send email by itself? Only if you allow it. By default every agent send waits for a person. An agent mailbox can send on its own to the recipients you allow.

Can I move my old mail in? Yes: from Google Takeout, .mbox and .eml files, or over IMAP from your current provider.

Support

Licence

cloudmail is fair source, under the Fair Core License:

  • The code is public. You can read it, change it and run it for your own use.
  • Running it needs a licence key (pricing). The key covers one deployment; Solo is licensed for one domain, Unlimited for any number.
  • The licence does not allow removing or bypassing the licence key check, or offering cloudmail to others as a competing product or service.
  • Each release becomes open source, under Apache 2.0, two years after it ships.

How the licence check works

  • Activation. An administrator pastes the licence key in the onboarding wizard (after Connect Cloudflare) or at Settings → Licence. The app sends the key once to the licence server, together with this deployment's id, its host name and the connected Cloudflare account id. It gets back a signed token bound to this deployment and host. Only the token is stored, in the auth Durable Object. The key is never stored or logged.
  • Checks. The app verifies the token offline against public keys bundled in shared/licence-keys.ts, and never fetches keys at runtime. The 5-minute cron refreshes it once a day, as does the first request after refresh_after. A token is valid for 30 days and is extended at each refresh. That is a check-in, not a renewal: there is nothing to pay again.
  • When a check fails. The app keeps working, and it keeps trying. If the licence server can't be reached, or answers with an error, an activated deployment never locks, however long that lasts: your mail does not depend on our server being there. Once the token is past its 30 days, admins see a banner, "The licence server can't be reached", and nothing else changes.
  • What does lock. An answer from the licence server that the licence is no longer good: revoked (a lost dispute, a deactivation, a key moved to another deployment). A deployment with no licence is locked from the start.
  • What still needs the licence server. Activating a key, moving a licence to a new deployment or host name, and upgrading Solo to Unlimited.
  • Your own LICENCE_SERVER_URL. A deployment that sets this variable to another server keeps a deadline: the banner counts down 7 days after the token's 30, then the app locks.
  • When locked:
    • The UI shows one "Activate your licence" screen: a key field for admins, "Ask your admin" for everyone else. API, MCP and token calls answer 402 licence_required.
    • Incoming mail is always received and stored, so nothing bounces. Forwarding, auto-replies, AI triage, push notifications and webhooks pause.
    • Sending stops. Scheduled sends that come due are held and go out after activation, and sequence steps stay pending.
    • Recipient-facing links keep working: unsubscribe, tracking, the privacy page and product logos.
    • Password reset still works, so an admin can always sign in to activate.
  • Moving or freeing a slot. Settings → Licence → Deactivate (with the key) frees this deployment's slot at the licence server, and the deployment locks.
  • Building from source. The check is part of every build, and no setting turns it off.

Licence and trademarks

cloudmail is licensed under the Fair Core License, version 1.0, with Apache 2.0 as its future licence (FCL-1.0-ALv2); see LICENSE. Third-party licence texts are in LICENSES/.

cloudmail is not affiliated with, endorsed by or sponsored by Cloudflare, Google or Microsoft. Cloudflare is a trademark of Cloudflare, Inc. Google Workspace is a trademark of Google LLC. Microsoft 365 and Outlook are trademarks of Microsoft Corporation.

Run your company's email in your own Cloudflare account

Buy a cloudmail licence, from $9   Visit trycloudmail.com

No installation packages available.

Remote

streamable-http
https://{domain}/mcp