mailflare README

项目的 README,来自 github.com/hieunc229/mailflare。合并为一个 markdown 文件:README.md。

Mailflare

Mailflare

A self-hosted alternative to Google Workspace: custom domain email, calendar, Drive, booking and built-in AI agents. For people and teams who want their own mail on Cloudflare, Docker or Vercel.

Don't want to manage a deployment? Try Mailflare Cloud, with high-deliverability email.

Deploy to Cloudflare Deploy with Vercel

Screenshots

Inbox
Inbox
Manage domains
Domains
Manage inboxes
Mailboxes
Calendar
Calendar
Booking
Booking
Drive
Drive

Features

Feature What you get
Email Personal or shared mailboxes on your domain, with access you control. Send and receive with Cloudflare Email, Resend or Amazon SES.
Routing rules Store, forward, reject or sort incoming mail, including one rule for newsletters and promotions.
Calendar Repeating events with time zones. Attendees get email invitations.
Booking A public link so anyone can book a free time on your calendar.
Drive Store and share files.
AI agents Search mail, draft replies and manage events. Connect other AI tools over MCP (Model Context Protocol).
Admin Users, API keys, webhooks, audit logs and backups.
Import Mail from IMAP, Gmail Takeout, .eml and .mbox. Calendar events, contacts and Drive files from Google Takeout.
Databases Cloudflare D1 (default), PostgreSQL, MySQL, Turso / libSQL or a SQLite file. Set DATABASE_URL to switch. Works with Supabase, Neon, PlanetScale, TiDB and more (databases).
File storage Cloudflare R2, Backblaze B2 or AWS S3.
Hosting Cloudflare Workers, one Docker container, or Vercel.

Mailflare supports 34 languages: English, Português (Brasil), Português (Portugal), Español, Français, Deutsch, Italiano, Nederlands, Polski, Українська, Русский, Türkçe, 中文(简体), 日本語, 한국어, Bahasa Indonesia, Bahasa Melayu, Tiếng Việt, ไทย, हिन्दी, বাংলা, मराठी, తెలుగు, தமிழ், ગુજરાતી, ಕನ್ನಡ, മലയാളം, ਪੰਜਾਬੀ, සිංහල, Kiswahili, Hausa, plus العربية, اردو and فارسی (right-to-left).

Cost

You can receive and send mail for free.

Task Service Price
Receive Cloudflare Email Routing Free
Send Resend Free tier: 3,000 emails a month
Send Amazon SES Free tier
Send Cloudflare Email Sending Needs the $5/month Paid Workers plan

New Amazon SES accounts start in a sandbox. Ask AWS for production access to lift it. Prices change, so check Resend, Amazon SES and Cloudflare.

Deploy to Cloudflare

You need:

Steps:

  1. Click Deploy to Cloudflare above. Keep the app name mailflare, or the app breaks.
  2. Add your CF_TOKEN when asked.
  3. Open the app at /setup and create your admin account.
  4. Add a domain from the same Cloudflare account.
  5. Create your first mailbox and send it a test message.

Details: Cloudflare guide. Problems: troubleshooting.

Self-host with Docker

Runs as one container on any server, with SQLite and local files.

git clone https://github.com/hieunc229/mailflare && cd mailflare
cp .env.docker.example .env.docker
docker compose up -d --build

Edit .env.docker first to set how mail is received and sent. To skip the build, use the prebuilt image: docker compose -f docker-compose.image.yml up -d.

Next: self-hosting guide.

Deploy to Vercel

Deploy with Vercel

Need Options
Database A hosted one, such as Turso from the Vercel Marketplace
Storage Vercel Blob (must be private; check the free limits), AWS S3 or Backblaze B2
Queues Vercel Queues (beta)
Receiving mail Email relay Worker, Resend or Amazon SES

The Hobby plan is for non-commercial use. After deploying, add the database and storage, then start the five-minute schedule. Keep the database in the same region as the functions, or first setup can take many minutes.

Next: Vercel guide.

Deploy with an AI agent

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

Install Mailflare for me from https://github.com/hieunc229/mailflare on my Cloudflare account.

1. Read README.md, docs/deploy-cloudflare.md and wrangler.jsonc first.
2. Ask me for my Cloudflare account ID and two API tokens, using a secret input:
   a deploy token (for Wrangler) and a runtime token (the Worker secret CF_TOKEN).
   Never print them, commit them, or pass them as command arguments.
3. Keep the Worker name exactly "mailflare". Create or reuse the D1 database
   "mailflare", the R2 bucket "mailflare-raw", and the queues "mailflare-inbound",
   "mailflare-outbound" and "mailflare-agent".
4. Install dependencies, run `npm run deploy`, and set CF_TOKEN as a Worker secret.
   Do not run remote database migrations yourself. The /setup page does that.
5. Give me the app URL and anything I still need to do. I will open /setup, create
   the admin account and connect my domain.

Token permissions: deployment guide.

Local development

cp .dev.vars.example .dev.vars
npm install
npm run db:migrate:local
npm run dev

Add your Cloudflare credentials to .dev.vars, then open localhost:3000.

Command What it does
npm run db:seed Load sample data (the app must be running)
npm run build Build the Worker
npm run deploy Build and deploy
npm run lint Lint

A schema change needs a migration for each database type. See migrations.

Documentation

Using Mailflare

Setup and reference

License

See LICENSE.

mailflare (hieunc229/mailflare)

正在搜索数据库…

这是什么?Mailflare 是一个基于 Cloudflare 构建的自托管自定义域名邮箱,支持通过 Cloudflare、Resend 或 Amazon SES 收发邮件。
这是 Cloudflare Worker 应用,还是我能在自己服务器上跑的 Docker 容器?两者都可以:它既可以部署为使用 D1 和 R2 的 Cloudflare Worker,也可以作为单个 Docker 容器在任何服务器上运行,改用 SQLite 和本地文件。
怎么部署它?点击 'Deploy to Cloudflare'(保持应用名称为 'mailflare'),打开部署好的应用并按照 /setup 创建管理员账号,然后绑定域名并创建你的第一个邮箱。
部署之前需要从 Cloudflare 准备什么?你需要一个绑定了域名的 Cloudflare 账号,以及一个权限受限的 CFTOKEN API 令牌,具有 Email Sending、DNS Settings、Email Routing Addresses、DNS、Email Routing Rules 和 Zone Settings 的编辑权限。
Worker 部署名称或发信费用上有什么坑?你必须把部署的 Worker 命名为 'mailflare',否则应用会出问题;而且通过 Cloudflare 自家邮件服务发信需要付费 Worker 计划(每月 5 美元),因为它没有免费额度。
可以在 VPS 上运行而不是用 Cloudflare Workers 吗?可以,Docker 版本可以作为单个容器在任何服务器上运行,使用 SQLite 和本地文件,并内置用于接收邮件的 SMTP 监听器。
我的邮件和附件实际存在哪里?无论你使用哪家发信提供商,邮件都保存在你自己的 Cloudflare D1 数据库中,附件保存在你自己的 R2 存储桶中(Docker 自托管版本则使用本地 SQLite/文件)。
除了邮件还包含什么?有日历吗?有,Mailflare 内置日历,可以安排带时区和参与人的周期性日程,还提供公开预约页面,让别人可以预约你的空闲时段。
AI 工具能和我的收件箱交互吗?可以,内置 AI 助手可以搜索邮件、起草回复和管理日程,还提供 MCP 接入,让外部 AI 客户端能够以受限的 API key 权限连接。
实际运行起来要花多少钱?通过 Cloudflare Email Routing 收信是免费的;发信用 Resend(每月 3,000 封)或 Amazon SES 的免费额度也免费,而用 Cloudflare 自家的发信服务需要每月 5 美元的付费 Worker 计划。
有哪些管理员控制功能?管理员可以管理用户、权限、API key、webhook、审计日志和备份,还能设置路由规则,自动存储、转发、拒收或归类收到的邮件。
作者
hieunc229
大小
73.8 MB
星标
7.8K
更新
提交Nov 18
时长
6个月
提交 · 90 天