envelopeOverview

Send transactional and bulk emails through Mailtrap's reliable infrastructure

Mailtrap's Email API provides a powerful and reliable way to send transactional and bulk emails through our infrastructure. Whether you're sending order confirmations, password resets, or marketing campaigns, our API has you covered.

Getting Started

1

Verify Your Sending Domain

Before sending emails, you need to verify ownership of your sending domain:

  1. Add your domain

  2. Configure DNS records (SPF, DKIM, DMARC)

  3. Verify the records

circle-exclamation
2

Get Your API Key

Navigate to API Tokensarrow-up-right in your Mailtrap account and generate a new API token with sending permissions.

circle-info

Keep your API token secure and never expose it in client-side code.

3

Install SDK or Use API

Choose an SDK for your programming language or use the API directly with cURL:

No installation required. Use cURL or any HTTP client to make API requests directly.

4

Send Your First Email

Here's a minimal example to send your first email:

curl -X POST https://send.api.mailtrap.io/api/send \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": {"email": "[email protected]"},
    "to": [{"email": "[email protected]"}],
    "subject": "Hello from Mailtrap",
    "text": "Welcome to Mailtrap Email API!"
  }'

Email Sending Options

Transactional Emails

Best for real-time, one-to-one emails triggered by user actions:

  • Order confirmations

  • Password resets

  • Account notifications

  • System alerts

  • Welcome emails

Endpoint: https://send.api.mailtrap.io/api/send

Bulk Stream

Optimized for high-volume marketing campaigns:

  • Newsletters

  • Promotional campaigns

  • Product announcements

  • Marketing emails

Endpoint: https://bulk.api.mailtrap.io/api/send

circle-info

Learn more about Bulk Stream and when to use it for your marketing emails.

Batch Sending

Send up to 500 emails in a single API call:

  • Personalized notifications

  • Event invitations

  • Account updates

  • Targeted campaigns

Endpoint: https://send.api.mailtrap.io/api/batch or https://bulk.api.mailtrap.io/api/batch

circle-info

Use send.api.mailtrap.io for transactional batch emails or bulk.api.mailtrap.io for marketing batch emails, depending on your stream.

Limits: 500 messages per call, 50 MB total payload

Features

Email Templates

Create reusable templates with variables for consistent branding and easy updates.

Manage Templatesarrow-up-right

Analytics & Tracking

Monitor delivery rates, opens, clicks, and bounces in real-time.

View Analyticsarrow-up-right

Webhooks

Receive real-time notifications for email events like delivery, bounce, and opens.

Configure Webhooksarrow-up-right

Testing with Sandbox

Before going to production, test your email integration with our Sandbox. All official SDKs support Sandbox mode with an easy switch.

circle-check
circle-info

Sandbox emails are captured in your test inbox instead of being delivered to recipients. Find your test inbox ID in your Mailtrap Sandboxarrow-up-right.

Last updated

Was this helpful?