Python
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:
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.

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?

