MoeMail 可以連接 AI 助理了
MoeMail
返回部落格

Open-Source AgentMail Alternative: Self-Host Agent Inboxes on Cloudflare

AgentMail is a hosted email service built for AI agents: each agent gets its own inbox and can send, receive and reply in threads. It is a good product. It is also a hosted one, and some teams want the inboxes, the mail and the keys on infrastructure they control. This post explains when an open-source alternative makes sense and how to run one on Cloudflare. We make MoeMail, the alternative described here; everything said about AgentMail comes from its own pages, listed at the end.

Two different tools

They overlap less than the word "inbox" suggests.

AgentMail treats an agent as an email user. Its plans list threads, labels, drafts, scheduled sends, custom domains, inbox pods, webhooks, WebSockets and an MCP server. It suits agents that hold conversations over days: support agents, outreach, assistants that answer mail.

MoeMail is a temporary email service. An agent, a test suite or a person creates an address, waits for a message, reads it and lets the mailbox expire. It suits sign-up and verification flows, QA and short tasks. It is open source, so you can run the whole service yourself.

AgentMailMoeMail
ModelLong-lived inboxes for agents that send and replyTemporary mailboxes that expire on their own (or permanent ones on paid roles)
Hosted plansFree: 3 inboxes, 3,000 emails a month; Developer $20 a month; Startup $200 a monthHosted at moemail.app: web inbox free, API calls a paid add-on
Run it yourselfNot stated; "BYO Cloud deployment" is listed for EnterpriseYes, open source, on your own Cloudflare account
Custom domains1 on Free, 10 on DeveloperAny domain you route to your deployment
MCPHosted server, OAuth or API keyHosted server at moemail.app/mcp; an npm server you can point at your own deployment
SendingYes, with daily limits per planYes, with a send quota

When the open-source route is the better fit

  • The mail must stay on your infrastructure. Verification codes and reset links are sensitive. Self-hosted, they live in your own Cloudflare account and never pass through a third party's service.
  • Cost at volume. On your own account there is no per-inbox or per-email price, only Cloudflare's own limits, and the free tier goes a long way for test traffic.
  • Your own domains, as many as you like. Route any domain's mail to the deployment and every address on it works.
  • You want to change it. The code is yours to read, audit and extend.

AgentMail is the better choice when the agent needs real two-way email with threads, deliverability tooling and a team plan, and you do not want to run anything.

How MoeMail runs on Cloudflare

The open-source version is built for Cloudflare's stack:

  • Cloudflare Pages serves the app and its API.
  • D1 stores mailboxes and messages; KV holds site settings.
  • Email Routing receives mail for your domain and hands it to an email Worker.
  • Expired mailboxes are deleted on a schedule, so storage does not grow without bound.

Deploy it

The repository is on GitHub at beilunyang/moemail, and its README is the reference. In outline:

  1. Fork the repository and add the secrets the GitHub Actions workflow needs: a Cloudflare API token and account ID, an auth secret, and the OAuth app details for sign-in.
  2. Run the deploy workflow from the Actions tab (or push a tag). It deploys the app, the email Worker and the cleanup Worker, with D1 and KV names you can set or leave at their defaults. You can also deploy from your machine with the repository's deploy script.
  3. Point a domain's email at it. In Cloudflare, enable Email Routing for your domain and send all addresses (a catch-all rule) to the email Worker.
  4. Sign in, set your domains in the site settings, and create an API key in your profile.

From then on the API is the same as on moemail.app, on your own domain: POST /api/emails/generate to create a mailbox, GET /api/emails/{id}/wait to wait for mail, GET /api/emails/{id}/{messageId} to read it.

Connect an AI agent

MoeMail's MCP server is on npm. Point it at your deployment with MOEMAIL_API_URL and give it a key from your own instance:

{
  "mcpServers": {
    "moemail": {
      "command": "npx",
      "args": ["-y", "@moemail/mcp"],
      "env": {
        "MOEMAIL_API_KEY": "mk_your_key",
        "MOEMAIL_API_URL": "https://temp.example.com"
      }
    }
  }
}

That works in Claude Desktop, Claude Code, Cursor and any client that runs local MCP servers. The agent gets tools to create a mailbox, wait for an email, read it and delete it. If you would rather not run anything, the hosted server at https://moemail.app/mcp signs in with OAuth instead of a pasted key; see the MCP page.

To give the agent only what it needs, create the key with the read and create actions and "only the mailboxes this key creates". A key like that cannot send mail or see the rest of the account.

Trade-offs of self-hosting

  • You run it. Updates, Cloudflare limits and anything that breaks are yours to handle.
  • Deliverability is your domain's. Receiving is simple; if you send mail, your domain's reputation and DNS records matter.
  • Some sites block temporary domains. A fresh domain of your own is less likely to be on block lists than a public temporary email domain, which is one more reason teams self-host.

Summary

Choose AgentMail when your agents need full, long-lived email accounts and you want a managed service. Choose MoeMail when you need inboxes on demand for verification, testing and short agent tasks, and especially when you want the service open source and on your own Cloudflare account. If you only need the inboxes and not the hosting, moemail.app is the same software, already running. For a wider comparison, see the best email APIs for AI agents, and for test automation, creating test inboxes via API.

Sources

Read on 2026-11-25. We make MoeMail; facts about AgentMail come only from the pages below.