skills/testing-with-sandbox/SKILL.md
Use when capturing outbound email in development or staging without delivering to real recipients, inspecting HTML or headers, running spam or structure checks, or automating tests against a fake inbox. Use when testing outgoing mail from an app without committing to a production ESP yet. Use when using Mailtrap Email Sandbox, Sandbox API, or sandbox-mode sending.
npx skillsauth add mailtrap/mailtrap-skills testing-with-sandboxInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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 sending-emails) for current sandbox mode options, inbox id, and constructor flags. Do not rely on memory.
Related skills: authorizing-api-requests (sandbox token scope, env vars, account_id resolution), sending-emails (live sending hosts and streams), using-email-templates (preview template sends in sandbox).
sending-emails).| 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 |
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. Full token scope, storage, and account_id resolution: see skill authorizing-api-requests.
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.
| 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.
sandbox.api.mailtrap.io / sandbox.smtp.mailtrap.io with a valid inbox id.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 |
| List messages | GET https://mailtrap.io/api/accounts/$MAILTRAP_ACCOUNT_ID/inboxes/{inbox_id}/messages | Messages |
| Fetch a message | GET https://mailtrap.io/api/accounts/$MAILTRAP_ACCOUNT_ID/inboxes/{inbox_id}/messages/{id} | Message details |
| Send test email | POST https://mailtrap.io/api/accounts/$MAILTRAP_ACCOUNT_ID/inboxes/{inbox_id}/messages | Send test emails |
For template testing, see the Integration tab of your template and Handlebars.
Official Mailtrap SDKs support sandbox/inbox operations and provide flags or methods to set test mode and inbox id. This allows you to use the same integration for both live sending and sandbox testing—simply change the mode or credentials depending on your environment (development, staging, or production). For install commands and language coverage, see Mailtrap developer documentation. Repository READMEs have the latest sandbox options:
| Mistake | Fix/Explanation |
| ------------------------------------------ | -------------------------------------------------------------------------------------------------------- |
| Expecting real delivery from sandbox | Mail in the sandbox is never delivered to recipients |
| Using production API token for sandbox | Use a token with proper sandbox/testing scope, granting access to the target inbox |
| Forgetting inbox id parameter | Always supply the inbox id (from UI or Integration tab) to associate messages with the correct inbox |
| Mixing sandbox and transactional endpoints | Testing API (sandbox.api.mailtrap.io) is not the same as send.api.mailtrap.io (live sending)! |
Each sandbox (test inbox) has an address like [email protected] for inbound tests; plus-addressing can help isolate scenarios. See Email address per sandbox for limits and behavior.
development
Use when creating or sending Mailtrap-hosted email templates, Handlebars personalization, template UUID in API payloads, or debugging variables and preview. Use when separating email design from application code for transactional or bulk sends.
tools
Use when adding or verifying a Mailtrap sending domain, DNS propagation issues, registrar or DNS provider steps, compliance after verification, or click tracking. Domain must be verified before sending from it.
development
Use when integrating, configuring, or troubleshooting Mailtrap live email sending (Email API or SMTP). Use when wiring outbound mail from an application or choosing how to send.
development
Use when converting or migrating email templates from another provider (SendGrid, Mailgun, Mandrill, Postmark, Brevo, Amazon SES) to Mailtrap-compatible Handlebars syntax. Supports single file, bulk directory, and inline HTML conversion.