mailtrap-testing-with-sandbox
它能做什么
这个工具让你发送测试邮件,而且这些邮件不会送达真正的收件人。它就像一个测试收件箱,帮你检查邮件是否被正确发送。
适用场景
- ✓开发网站或应用、想测试外发邮件时。
- ✓在把邮件发给客户之前,检查邮件的外观和内容。
- ✓在自动化测试中,确认邮件功能符合预期。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/mailtrap-testing-with-sandbox/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“设置发送测试邮件到我在 Mailtrap 中的测试收件箱。”
每周 5 个新技能,1 分钟读完。
工作原理
你需要配置系统,让它把邮件发送到一个特殊的 Mailtrap 地址,而不是真实收件人的地址。这样邮件就会保存在 Mailtrap 中,供你查看。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Testing with Mailtrap Email Sandbox
Overview
Email Sandbox captures mail in sandboxes (test inboxes)—a test environment where messages are not delivered to real recipients. You can send to sandboxes using our SDKs, HTTP API, or SMTP, depending on your needs.
Before generating SDK code: read the README of the relevant SDK repository (see mailtrap-sending-emails) for current sandbox mode options, inbox id, and constructor flags. Do not rely on memory.
Related skills: mailtrap-sending-emails (live sending hosts and streams).
When to use
- You want no real delivery: dev, staging, CI, or demos where mail must stay in a test inbox.
- You need to inspect what was sent: bodies, headers, attachments, or basic checks (e.g. spam report) via Sandbox / Testing API or the UI.
- You are automating tests against captured mail.
- You will only change SMTP settings so an existing app sends into a sandbox—no need for a framework-by-framework tutorial from this skill.
When not to use
- Live sends to real recipients (
mailtrap-sending-emails). - For full framework setup guides or detailed API references, link users to Mailtrap's Integration tab for SMTP/API details and the API docs for specifics—don't cover every framework or API field here.
Quick reference
API base
| Service | Send mail URL | Auth header examples |
|---|---|---|
| Email Testing API (REST) | https://sandbox.api.mailtrap.io/api/send/{inbox_id} |
Authorization: Bearer $MAILTRAP_SANDBOX_API_TOKEN |
Tokens and account_id
Sandbox uses a separate token ($MAILTRAP_SANDBOX_API_TOKEN, Testing/Sandbox scope) — never reuse the live $MAILTRAP_API_TOKEN. The account_id in the example endpoints below is resolved at runtime via GET https://mailtrap.io/api/accounts. Store tokens in environment variables or a secrets manager.
When to use API vs SMTP
Use SMTP when testing apps that already send mail via SMTP (just update the host, port, and credentials). Use the HTTP API when building new integrations or your app can make HTTP requests; it's better for programmatic testing and automation.
SMTP settings (sandbox)
| Setting | Value |
|---|---|
| Host | sandbox.smtp.mailtrap.io |
| Ports | 2525 (default), 25, 465 (SSL), 587 |
| Username / Password | Per sandbox credentials from the Integration tab in the Mailtrap UI |
Never use sandbox credentials or endpoints in production. Messages will only be captured in the sandbox, not delivered.
Key parameters
- Inbox ID: Every sandbox (test inbox) has a unique inbox id, visible in the UI URL and needed for sending or REST API operations.
- Token scope: Use a token with permissions for the relevant project and test inbox.
Typical use cases
- Capture all outbound mail in dev, test, or staging (no real recipients).
- View, validate, and assert message headers, bodies, HTML, attachments, or spam score.
- Run integration or CI checks that read from the Email Sandbox API.
- Test Mailtrap templates by pointing API or SDK/SMTP at
sandbox.api.mailtrap.io/sandbox.smtp.mailtrap.iowith a valid inbox id.
Example API paths
Use API docs for details, but typical endpoints include:
| Operation | URL | Reference |
|---|---|---|
| List sandboxes | GET https://mailtrap.io/api/accounts/$MAILTRAP_ACCOUNT_ID/inboxes |
Sandboxes API |
…
常见问题
我需要 Mailtrap 账号吗?
需要,你必须拥有 Mailtrap 账号才能使用测试收件箱。
我可以用它给真实的人发邮件吗?
不可以,这个工具仅用于测试,邮件不会送达真实收件人。
我如何查看用于测试而发送的邮件?
你可以直接在 Mailtrap 界面中查看这些邮件,它们都保存在那里。
详情
作者的原始描述
Capture outbound email in Mailtrap Email Sandbox for development, staging, CI, HTML inspection, spam checks, and fake inbox tests.
热度
- GitHub 星标
- 48k
- 排名
- #5136
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。