内容
<p align="center">
<br />
<img src="logo.svg" alt="MailCue" width="320" />
<br />
<em>一个单容器中运行的逼真邮件测试服务器。</em>
<br /><br />
<a href="https://github.com/Olib-AI/mailcue/actions"><img src="https://img.shields.io/github/actions/workflow/status/Olib-AI/mailcue/ci.yml?branch=main&style=flat-square&label=CI" alt="CI" /></a>
<a href="https://github.com/Olib-AI/mailcue/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" alt="MIT License" /></a>
<a href="https://github.com/Olib-AI/mailcue/pkgs/container/mailcue"><img src="https://img.shields.io/badge/GHCR-ghcr.io%2Folib--ai%2Fmailcue-blue?style=flat-square&logo=github" alt="GHCR" /></a>
<a href="https://github.com/Olib-AI/mailcue/stargazers"><img src="https://img.shields.io/github/stars/Olib-AI/mailcue?style=flat-square" alt="GitHub Stars" /></a>
<a href="https://github.com/Olib-AI/mailcue/releases"><img src="https://img.shields.io/github/v/release/Olib-AI/mailcue?style=flat-square" alt="Latest Release" /></a>
<a href="https://www.olib.ai"><img src="https://img.shields.io/badge/by-Olib%20AI-6c47ff?style=flat-square" alt="Olib AI" /></a>
<br />
<a href="https://github.com/Olib-AI/mailcue/blob/main/openapi.json"><img src="https://img.shields.io/badge/OpenAPI-3.1-6BA539?style=flat-square&logo=openapiinitiative" alt="OpenAPI Spec" /></a>
<a href="https://github.com/Olib-AI/mailcue/blob/main/postman_collection.json"><img src="https://img.shields.io/badge/Postman-Collection-FF6C37?style=flat-square&logo=postman&logoColor=white" alt="Postman Collection" /></a>
</p>
---
MailCue 将 Postfix、Dovecot、OpenDKIM、OpenDMARC、SpamAssassin、FastAPI REST API 和 React 网页界面打包成一个由 s6-overlay 管理的 Docker 容器。它运行一个完整的邮件栈,包括 IMAP/POP3 访问、DKIM 签名、DMARC 验证、垃圾邮件过滤、TLS 和 GPG 加密,这样您就可以测试邮件在生产环境中的行为。设置 `MAILCUE_MODE=production` 后,同一个容器将作为一个真实的邮件服务器运行。
**[功能](#功能)** · **[快速开始](#快速开始)** · **[文档](#文档)** · **[贡献](#贡献)**
<p align="center">
<img src="examples/regular-email.png" alt="MailCue inbox showing a rich HTML invoice email" width="860" />
</p>
<p align="center">
<img src="examples/gpg-encrypted-email.png" alt="MailCue displaying a PGP-encrypted email with credentials" width="860" />
</p>
<p align="center">
<img src="examples/settings.png" alt="MailCue settings page with GPG keys, TLS certificate, mail server, and domain management tabs" width="860" />
</p>
## 功能
| 功能 | 描述 |
|---|---|
| 泛SMTP | 接受任何地址在任何域上的邮件。没有任何内容离开容器。 |
| IMAP 和 POP3 | 使用任何标准客户端通过 STARTTLS 或隐式 TLS 读取捕获的邮件。 |
| 网页界面 | 具有邮箱侧边栏、文件夹导航、电子邮件查看器和撰写对话框的 React 应用程序。 |
| REST API 和 SDK | 用于发送、接收、注入、搜索和删除电子邮件的 JSON API,带有 Python 和 Node SDK。 |
| 电子邮件注入 | 通过 IMAP APPEND 将消息直接插入邮箱,以进行确定性测试设置,并带有真实的头部。 |
| DKIM、DMARC、SPF | OpenDKIM 签名、OpenDMARC 验证和 SPF 策略检查,带有 Authentication-Results 头部。 |
| 垃圾邮件过滤 | SpamAssassin 对传入邮件进行评分,带有可配置的阈值、贝叶斯过滤和 RBL 检查。 |
| 全面 TLS | 为 SMTP STARTTLS、IMAPS 和 POP3S 自动生成证书。从界面上传您自己的证书。 |
| GPG / PGP-MIME | 每个邮箱的 GPG 密钥。签署、加密、验证和解密邮件(RFC 3156)。将密钥发布到 keys.openpgp.org。 |
| 实时事件 | 服务器发送事件流推送 email.received、email.deleted、mailbox.created 等。 |
| 作用域 API 密钥 | X-API-Key 认证,带有每个密钥的作用域(读取、发送、删除等)和可选的邮箱允许列表。 |
| MCP 服务器 | 官方模型上下文协议服务器为 AI 代理提供自己的邮箱。 |
| 域名管理 | 添加自定义域名,带有自动 DKIM 和 DNS 仪表板,用于 MX、SPF、DKIM、DMARC、MTA-STS 和 TLS-RPT。 |
| 多用户 | 每个用户的邮箱配额和隔离的邮箱、电子邮件、GPG 密钥和 API 密钥。 |
| 生产模式 | 一个加固的邮件服务器,带有严格的域名、所需的 TLS、DMARC 拒绝和 Let's Encrypt 证书。 |
| 提供商沙盒 | 使用线路相同的端点和签名 webhook 捕获外发 SMS、语音和聊天 API 流量。 |
| 单容器 | 一个 docker 运行。不需要外部数据库、Redis 或消息队列。带有可选的 AES-256 加密的 SQLite。 |
## 快速开始
### Docker Compose
```bash
git clone https://github.com/Olib-AI/mailcue.git
cd mailcue
docker compose up -d
```
打开 **http://localhost:8088**,使用用户名 `admin` 和密码 `mailcue` 登录。
### Docker 运行
```bash
docker run -d \
--name mailcue \
-p 8088:80 \
-p 25:25 \
-p 587:587 \
-p 143:143 \
-p 993:993 \
-v mailcue-data:/var/mail/vhosts \
-v mailcue-db:/var/lib/mailcue \
-e MAILCUE_DOMAIN=mailcue.local \
-e MAILCUE_ADMIN_PASSWORD=mailcue \
ghcr.io/olib-ai/mailcue
```
### 检查是否正常工作
```bash
curl http://localhost:8088/api/v1/health
```
## 文档
> 📖 在 **[官方 MailCue 文档网站](https://olib-ai.github.io/mailcue/)** 上阅读完整、交互式的指南。
| 指南 | 涵盖内容 |
|---|---|
| [架构](docs/guides/architecture.md) | 容器布局、请求流程和技术栈。 |
| [配置](docs/guides/configuration.md) | 环境变量和暴露的端口。 |
| [API 参考](docs/guides/api.md) | REST 端点、身份验证和 API 密钥范围。 |
| [生产部署](docs/guides/production.md) | 加固模式、DNS 记录和 TLS 证书。 |
| [电子邮件客户端和 TLS 信任](docs/guides/clients.md) | IMAP/POP3/SMTP 设置和信任 CA。 |
| [在 CI/CD 中使用](docs/guides/ci.md) | 管道设置和平台示例。 |
| [MCP 服务器](docs/guides/mcp.md) | 通过 MCP 为 AI 代理提供自己的邮箱。 |
| [提供商沙盒和 HTTP 容器](docs/guides/sandbox.md) | 捕获 SMS、语音和聊天流量,并检查 HTTP 请求。 |
| [在项目之间共享 MailCue](docs/guides/networking.md) | 在共享的 Docker 网络后面运行一个容器。 |
| [开发和贡献](docs/guides/development.md) | 本地设置、 linting、测试和拉取请求流程。 |
API 也作为交互式 Swagger UI 在 `/api/docs` 处提供,带有机器可读的规范,位于 [openapi.json](openapi.json) 和 [postman_collection.json](postman_collection.json) 中。
SDK 和 MCP 服务器有自己的文档:[Python SDK](sdks/python/README.md)、[Node SDK](sdks/node/README.md) 和 [MCP 服务器](sdks/mcp-node/README.md)。
## 贡献
欢迎贡献。参见 [开发和贡献](docs/guides/development.md),了解本地设置、 linting、类型检查、测试和拉取请求流程。
## 许可证
MIT。参见 [LICENSE](LICENSE)。
## 星级历史
<a href="https://star-history.com/#Olib-AI/mailcue&Date">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=Olib-AI/mailcue&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=Olib-AI/mailcue&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=Olib-AI/mailcue&type=Date" width="600" />
</picture>
</a>
## 链接
- **Olib AI**: [www.olib.ai](https://www.olib.ai)
- **GitHub**: [github.com/Olib-AI/mailcue](https://github.com/Olib-AI/mailcue)
- **容器注册表**: [ghcr.io/olib-ai/mailcue](https://github.com/Olib-AI/mailcue/pkgs/container/mailcue)
- **API 文档**: 在运行时可在 `/api/docs` 处访问
- **问题**: [github.com/Olib-AI/mailcue/issues](https://github.com/Olib-AI/mailcue/issues)
- **讨论**: [github.com/Olib-AI/mailcue/discussions](https://github.com/Olib-AI/mailcue/discussions)
---
<p align="center">
如果您觉得 MailCue 有用,请考虑在 GitHub 上给它一个 <a href="https://github.com/Olib-AI/mailcue">星星</a>。它可以帮助其他人发现该项目。
</p>
<p align="center">
由 <a href="https://www.olib.ai">Olib AI</a> 构建
</p>