skillfed

mailtrap

Official mailtrap.io API client

mailtrap v2.7.0 110.2K downloads/30d#12,480 on PyPI47
Permissive license The MIT License (MIT) Copyright (c) 2023 Railsware Products Studio LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files… (full text in the JSON record) Active released

What it is and what it does

Mailtrap is the official Python client for Mailtrap's email platform, a service that combines email sending (transactional and bulk streams) with sandbox testing and contact management. It wraps Mailtrap's REST API behind a Pythonic interface, letting you send individual or batch emails, use pre-built templates, manage inboxes and messages in a sandbox environment, and handle contacts and mailing lists. The package depends only on requests for HTTP calls and pydantic for data validation, keeping the installation lightweight.

You use it by instantiating a MailtrapClient with your API token, then constructing Mail or MailFromTemplate objects and calling send() or batch_send(). The client supports switching between sandbox (for testing) and production (for live sending) via configuration flags. It's designed for developers integrating email into Python applications who want a managed service rather than self-hosted SMTP infrastructure.

Use it for:

  • Send transactional emails (password resets, order confirmations) from a Python web application.
  • Test email templates and rendering in a sandbox before deploying to production.
  • Manage bulk email campaigns with template variables and contact lists.
  • Validate email content and HTML/CSS compliance using Mailtrap's testing sandbox.
  • Integrate email sending into a Django, FastAPI, or Flask application without configuring SMTP.
  • Batch-send personalized emails to multiple recipients with template substitution.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Official Python client for Mailtrap's email sending and testing APIs, supporting transactional and bulk email delivery, sandbox testing, templates, and contact management.

Yes. The package is actively maintained, has minimal dependencies, supports current Python versions, carries no known vulnerabilities, and is MIT-licensed. Install it if you are already using Mailtrap or evaluating it as your email service. Skip it if you need a generic SMTP client or are committed to a different email provider.

Install

mailtrap on PyPI

pip

pip install mailtrap

uv

uv add mailtrap

poetry

poetry add mailtrap

Installing mailtrap

Before you install

Low install friction with only two runtime dependencies (requests and pydantic). Actively maintained with recent releases; last commit 2026-08-14 and version released 2026-08-04. Supports current Python versions (3.9+).

License in practice

MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for commercial and open-source projects alike.

Quickstart

pip install mailtrap

import mailtrap as mt
import os

client = mt.MailtrapClient(token=os.environ["MAILTRAP_API_KEY"])
mail = mt.Mail(
    sender=mt.Address(email="sender@example.com", name="John Smith"),
    to=[mt.Address(email="recipient@example.com")],
    subject="Test",
    text="Hello!",
)
client.send(mail)

Requires Python 3.9 or later and a valid Mailtrap API token from https://mailtrap.io/api-tokens.

Verify before relying

  • Rate limits or quota constraints for transactional vs. bulk sending streams.
  • Whether the package supports async/await patterns for concurrent email sending.
  • Specific retry behavior and timeout defaults for API calls.

Package facts

License The MIT License (MIT) Copyright (c) 2023 Railsware Products Studio LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files… (full text in the JSON record) (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 2 — requests, pydantic
Maintenance actively maintained — 10 days since the last release
Last repo commit
First released
Downloads 110,187/month — #12,480 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: mailtrap-2.7.0-py3-none-any.whl

License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Application Frameworks

Tags

mailtrap email clientpython email sending apitransactional email serviceemail sandbox testingmailtrap integrationbulk email sendingemail template api
email-sendingapi-clienttesting-sandbox

More Application Frameworks packages