Python

Mailtrap Python SDK on GitHub

Overview

Mailtrap can be integrated with Python apps and projects for email sending purposes.

Email API/SMTP for Python

SDK Integration

The Mailtrap Python SDK is a Pythonic library for sending transactional and bulk emails with full type hints support. The SDK supports:

  • Transactional email sending

  • Batch email sending

  • Template management

  • Contact management

  • Sandbox testing

  • Account management

  • Type hints for better IDE support

Installation

Install the SDK using pip:

Minimal Example

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

Get your API token from your Mailtrap account under Settings → API Tokens.

SMTP Integration

To integrate SMTP with your Python app, navigate to the Integrations tab, choose the desired Python framework, and copy-paste the credentials or ready-made code snippets.

SMTP integration is compatible with any Python framework or library that sends emails using SMTP.

For more information read the SMTP Integration article.

RESTful API Integration

To integrate Mailtrap using RESTful API, use the configuration available among Code samples under the API section.

API integration can be used with any Python framework or library that supports HTTP requests. For more details, refer to the API documentation.

Read more about API integration in the dedicated article.

Last updated

Was this helpful?