Back to Skills

mailtrap-email-integration

Guides agents through integrating transactional email sending via Mailtrap's Email API, including sandbox testing, domain verification, and API authentication. Use when implementing email-sending features, debugging delivery issues, or setting up safe dev/staging email testing.

240,390stars36,474forksUpdated 8/16/2026

Security Assessment

Safe(94/100)
Security Score94/100

About mailtrap-email-integration

Mailtrap Email Integration guides agents through adding transactional email sending to an application using Mailtrap's Email API and Sandbox. It solves a recurring set of integration problems: test emails accidentally reaching real inboxes, silent delivery failures, and leaked credentials. The skill activates when implementing send-email features (signup confirmation, password reset, notifications, receipts), debugging why mail is not arriving in dev or staging, standing up a first email integration, or reviewing code that calls an email API without sandbox separation.

It centers on three concepts: strict sandbox-versus-production separation so non-production environments route to Mailtrap's Sandbox endpoint that captures mail without delivering it; Bearer-token authentication with separate, per-project tokens for sandbox and production; and domain verification via SPF, DKIM, and DMARC DNS records before production sending is enabled. It includes TypeScript code examples for a production send and for environment-based endpoint switching, an anti-patterns table (production endpoint in dev, hardcoded tokens, sending before domain verification, missing error handling), and best practices around separate environment variables, DNS verification, failure logging, and treating sends as fallible network calls.

The skill is written for application developers and AI coding agents adding or debugging email delivery. Its security posture is defensive: it explicitly warns against hardcoding tokens in source and recommends loading them from environment variables or a secrets manager, and it documents credential handling as standard setup rather than performing any exfiltration or risky operation.

FAQ

What problem does the sandbox separation solve?

The Sandbox endpoint captures emails without delivering them, so dev and staging test messages never reach real inboxes. The skill's rule is to route non-production environments to the Sandbox endpoint and never point dev at the production sending endpoint.

How is authentication handled?

Requests use a Bearer token in the Authorization header, loaded from an environment variable. Sandbox and production use separate, per-project tokens that should never be shared across environments.

What do I need before sending to real recipients?

Production sending requires verifying your sending domain via SPF, DKIM, and DMARC DNS records. Sending before verification completes causes silent failures or spam-folder placement.

Does the skill encourage safe credential handling?

Yes. It explicitly calls out hardcoding API tokens in source as an anti-pattern and recommends environment variables or a secrets manager, plus logging delivery failures with debugging context.

What language are the examples in?

The provided code examples are TypeScript using fetch against Mailtrap's send API and a NODE_ENV-based endpoint switch, but the patterns apply to any language.

Install mailtrap-email-integration

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill

Repository

affaan-m/ecc