AGENT SKILLBY AFFAAN-M
Mailtrap email integration
AT A GLANCE
Mailtrap email integration is an email agent skill from affaan-m. Guides agents through integrating transactional email sending via Mailtrap's Email API, including sandbox testing, domain verification, and API authentication. It is published in the affaan-m/ecc GitHub repository (243K stars) under the MIT license. Install it with: npx skills add affaan-m/ecc --skill mailtrap-email-integration
- SOURCE REPOSITORY
- affaan-m/ecc (opens GitHub in a new tab)
- REPO STARS
- SOURCE REPOSITORY
- LICENSE
- MIT
- CATEGORIES
- SKILL.MD SIZE
- 3.4 KB72 LINES
QUICK ANSWER
- WHAT IT IS01
- Guides agents through integrating transactional email sending via Mailtrap's Email API, including sandbox testing, domain verification, and API authentication. It stands out by giving email marketing a defined shape, so the agent asks for better context and returns a more usable result.
- INPUTS02
- Context for email marketing: your goals, audience, constraints, and any source material the skill asks for.
- OUTPUT03
- A ready-to-use result for email marketing: the analysis, copy, or recommendations the agent produces.
INSTALL
One command adds this skill from its source repository.
npx skills add affaan-m/ecc --skill mailtrap-email-integrationREAD THE SKILL.MD BELOW BEFORE YOU RUN IT. SKILLS INSTRUCT YOUR AGENT.
SKILL.MD
The full file, as published in the source repository. Copy it, download it or open it on GitHub.
ON THIS PAGE · 6
Mailtrap Email Integration#
Patterns for adding transactional email sending to an application using Mailtrap's Email API and Sandbox, covering authentication, environment separation, and common delivery pitfalls.
When to Activate#
- Implementing a "send email" feature (signup confirmation, password reset, notifications, receipts)
- Debugging why emails aren't arriving in dev/staging
- Setting up a project's first email-sending integration
- Reviewing code that calls an email API directly without sandbox separation
Core Concepts#
Sandbox vs. Production separation. Mailtrap provides a Sandbox API that captures emails without delivering them, used for dev/staging so test emails never reach real inboxes. Production sending uses a separate, verified-domain endpoint. Never point a dev environment at the production sending endpoint.
Authentication. Requests use a Bearer token in the Authorization header. Tokens are scoped per project; sandbox and production typically use different tokens.
Domain verification. Production sending requires verifying a sending domain via DNS records (SPF, DKIM, DMARC) before Mailtrap will deliver to real recipients. Skipping this causes silent delivery failures or spam-folder placement.
Code Examples#
// Sending via Mailtrap's Email API (production)
async function sendEmail(to: string, subject: string, html: string) {
const response = await fetch("https://send.api.mailtrap.io/api/send", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.MAILTRAP_API_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
from: { email: "no-reply@yourverifieddomain.com", name: "Your App" },
to: [{ email: to }],
subject,
html,
}),
});
if (!response.ok) {
throw new Error(`Email send failed: ${response.status}`);
}
return response.json();
}// Same call, routed to Sandbox in non-production environments
const MAILTRAP_ENDPOINT = process.env.NODE_ENV === "production"
? "https://send.api.mailtrap.io/api/send"
: `https://sandbox.api.mailtrap.io/api/send/${process.env.MAILTRAP_INBOX_ID}`;Anti-Patterns#
| Anti-Pattern | Why It's a Problem | Instead |
|---|---|---|
| Using the production sending endpoint in dev/test | Real test emails reach real inboxes, risking spam complaints and leaked test data | Route non-production environments to the Sandbox endpoint |
| Hardcoding API tokens in source | Credential leak risk if committed to version control | Load tokens from environment variables / secrets manager |
| Sending before domain verification completes | Emails silently fail or land in spam | Verify SPF/DKIM/DMARC records before enabling production sending |
| No retry/error handling on send failures | Silent notification failures (e.g., user never gets password reset email) | Check response status, log failures, surface actionable errors |
Best Practices#
- Keep sandbox and production tokens in separate environment variables, never share one token across environments
- Verify sending domain DNS records before any production launch involving email
- Log delivery failures with enough context to debug (recipient, template, timestamp, response code)
- Treat email sending as a fallible network call: wrap in try/catch, never assume success
Related Skills#
api-and-interface-design, security-and-hardening, ci-cd-and-automation
FAQ
07 QUESTIONS
01What is the Mailtrap email integration agent skill?
Guides agents through integrating transactional email sending via Mailtrap's Email API, including sandbox testing, domain verification, and API authentication. It is listed under email in the 100xLab agent skills directory.
02How do I install Mailtrap email integration in Cursor, Claude Code, or Codex?
Run npx skills add affaan-m/ecc --skill mailtrap-email-integration in the project where you want it, then ask your agent for the skill by name. The --skill flag installs only Mailtrap email integration, not every skill in the repository.
03What does the Mailtrap email integration SKILL.md cover?
The SKILL.md includes sections on When to Activate, Core Concepts, Code Examples, Anti-Patterns, Best Practices and Related Skills. Read the full text on this page or in plain markdown at /resources/agent-skills/affaan-m-ecc--mailtrap-email-integration--xgwed6/raw.
04Which agents can use Mailtrap email integration?
Mailtrap email integration installs with the cross-agent skills installer (npx skills add), which sets it up for agents such as Claude Code, Cursor and Codex. Each agent loads the SKILL.md when you ask for the skill by name.
05What license is Mailtrap email integration under?
The affaan-m/ecc repository declares the MIT license. Read the license file in the repository before you copy or redistribute the skill.
06Is Mailtrap email integration free to use?
Reading, copying and installing Mailtrap email integration costs nothing: it is published in a public GitHub repository under the MIT license. Reuse and redistribution follow that license.
07Where is the source of Mailtrap email integration?
Mailtrap email integration comes from https://github.com/affaan-m/ecc, which has 243K GitHub stars. The SKILL.md is at https://github.com/affaan-m/ecc/blob/HEAD/skills/mailtrap-email-integration/SKILL.md. The author is affaan-m.
Need an agent workflow built around your stack?
Tell us the workflow you want automated. We reply within 4 working hours (IST).
ATTRIBUTION
Mailtrap email integration was written by its original authors and is published in affaan-m/ecc (opens GitHub in a new tab) under the MIT license. All rights stay with the original authors.
100xLab did not write, maintain or endorse this skill. This page lists it for discovery. Repo stars belong to the source repository, not to the skill. Review any skill before you install it.