How it works
Composio is an agent infrastructure platform that connects AI models to 1,000+ external tools through a single SDK and MCP endpoint. The Mailtrap toolkit inside Composio gives agents 49 pre-built actions spanning Email Sandbox inspection, template management, contact operations, sending domain configuration, and deliverability analytics.
Connect your Mailtrap account once via API token, and every agent in your Composio workspace, whether running on OpenAI, Anthropic, LangChain, CrewAI, AutoGen, or any other supported framework, can call Mailtrap actions through natural language.
Configuration
Step 1: Create a Composio account at composio.dev (free tier: 20,000 tool calls/month)
Step 2: Get your Mailtrap API token from https://mailtrap.io/settings/api-tokens
Step 3: Connect Mailtrap in the Composio dashboard under Integrations → Mailtrap and enter your API token
Step 4: Install the SDK: npm install @composio/core (TypeScript) or pip install composio (Python)
Step 5: Initialize a session and retrieve tools:
import { Composio } from '@composio/core';
const composio = new Composio({ apiKey: process.env.COMPOSIO_API_KEY });
const session = await composio.create('your-user-id');
const tools = await session.tools(); // includes all 49 Mailtrap actions
Note: For MCP-based clients (Claude Desktop, Cursor, custom MCP agents), connect to session.mcp.url instead. All 49 Mailtrap actions appear automatically in your client without additional configuration.
For a detailed guide, consult the dedicated Composio Integration article.
Use cases
- After your agent sends a test email through Mailtrap SMTP, have it call
MAILTRAP_LIST_MESSAGESandMAILTRAP_GET_MESSAGE_HTML_BODYto inspect the sandbox result and validate subject, rendering, and links — without opening the Mailtrap dashboard. - Let an agent update your email templates directly from plain-language instructions: “Update the password-reset template to shorten the body copy and replace the footer logo” triggers
MAILTRAP_UPDATE_EMAIL_TEMPLATEwith the changes applied automatically. - Run a daily deliverability check with a scheduled agent: it calls
MAILTRAP_GET_SENDING_STATS_BY_DATE, compares bounce and open rates against your thresholds, and alerts your team via another Composio toolkit if something looks off. - When a new user signs up, trigger an agent to call
MAILTRAP_CREATE_CONTACTand assign them to the right list, with custom fields populated directly from your CRM data.
Supported functionalities
- Inspect Email Sandbox inboxes and retrieve full message content (HTML and plain text)
- Create, retrieve, update, and delete email templates
- Manage contacts, contact lists, and custom contact fields
- Import and export contacts in bulk
- Track delivery statistics by date, category, sending domain, and email service provider
- Configure and manage sending domains
- View email suppression lists (bounces, complaints, unsubscribes)
- Monitor account billing usage