mailgun
Python SDK for Mailgun
Decision gist · record as of 2026-08-14
Yes. This is the official Mailgun SDK with active maintenance, low install friction, no known vulnerabilities, and broad API coverage. Install it if you use Mailgun for email delivery and want a well-supported, type-hinted Python client. The Alpha status reflects ongoing development, not instability—recent releases and active commits show it is production-ready.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.11 or later.
- Mailgun API credentials (domain and API key) must be provided.
- Active maintenance with a recent release (10 days old).
License · maintenance · safety
Apache-2.0 (permissive) — Apache-2.0 permissive license allows commercial and private use with minimal restrictions.
last release 2026-08-04 (10 days) · last repo commit 2026-08-14 · 9 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 367,377 downloads/mo, #7,197 on PyPI
Alternatives
Verify before relying
pip install mailgun
from mailgun import Mailgun
client = Mailgun(domain='example.com', api_key='your-api-key')
response = client.messages.send(to='user@example.com', subject='Hello', text='Test message')- Whether async support via httpx2 is production-ready or still experimental given the Alpha development status.
- Performance characteristics when handling large attachment streams with ChunkedStreamer.
- Exact retry and timeout defaults for exactly-once delivery semantics.
What it is and what it does
Mailgun is the official Python SDK for Mailgun's email delivery platform. It wraps Mailgun's REST API to let you send transactional emails, manage sender domains, configure webhooks, retrieve delivery events, and access suppression lists—all from Python code. The SDK supports both synchronous (requests-based) and asynchronous (httpx/httpx2-based) clients, so you can integrate it into blocking or async applications.
The package handles common email workflows: sending plain or templated messages with attachments, scheduling delivery, tracking bounces and complaints, managing mailing lists, and querying delivery metrics and logs. It includes features like memory-safe attachment streaming, fluent message builders, strict payload validation, and development-mode credential redaction. The SDK is actively maintained, compatible with Python 3.11+, and carries an Apache-2.0 license.
Use it for
- Send transactional emails (password resets, order confirmations) from a web application using the synchronous client.
- Build an async email notification system that queries delivery events and bounce data via streaming pagination.
- Manage email domain configuration, DKIM keys, and tracking settings programmatically.
- Implement a mailing list with suppression rules (bounces, unsubscribes, complaints) integrated into your application.
- Monitor email delivery metrics and logs to track campaign performance and diagnose delivery issues.
- Schedule emails for future delivery and attach files without loading entire payloads into memory.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
This is the official Mailgun SDK with active maintenance, low install friction, no known vulnerabilities, and broad API coverage. Install it if you use Mailgun for email delivery and want a well-supported, type-hinted Python client. The Alpha status reflects ongoing development, not instability—recent releases and active commits show it is production-ready.
Install
mailgun on PyPI
Before you install
Active maintenance with a recent release (10 days old). Low install friction—pure Python wheel with three HTTP client options (requests, httpx, httpx2). Requires Python 3.11+.
Requires Python 3.11 or later. Mailgun API credentials (domain and API key) must be provided.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions.
Quickstart
pip install mailgun
from mailgun import Mailgun
client = Mailgun(domain='example.com', api_key='your-api-key')
response = client.messages.send(to='user@example.com', subject='Hello', text='Test message')
Verify before relying
- Whether async support via httpx2 is production-ready or still experimental given the Alpha development status.
- Performance characteristics when handling large attachment streams with ChunkedStreamer.
- Exact retry and timeout defaults for exactly-once delivery semantics.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.11 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packageshttpx2httpxrequests |
| Maintenance | Actively maintained 10 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 367,377 / month, #7,197 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 3 - AlphaEnvironment :: ConsoleIntended Audience :: DevelopersNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonTopic :: Communications :: EmailTopic :: Utilities |
Evidence: mailgun-1.9.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “mailgun email api python”
- mailgunOfficial Python SDK for the Mailgun email service API, providing…
- django-anymailSends and receives email in Django through multiple transactional…
- zerobouncesdkPython SDK for the ZeroBounce email validation and verification API,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also django-anymail · mailtrap · odg-client · mailman · mailjet-rest · postmarker · brevo-python · django-post_office · zerobouncesdk · yagmail