--- id: mailgun version: "1.9.0" license: Apache-2.0 license_treatment: permissive maintenance: active --- # mailgun — Python SDK for Mailgun License: permissive · Maintenance: active · Downloads: 367.4K/mo ## 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 above — verify before relying. Official Python SDK for the Mailgun email service API, providing synchronous and asynchronous clients to send messages, manage domains, webhooks, templates, and access email delivery metrics. 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 pip install mailgun uv add mailgun poetry add mailgun ## Installing mailgun 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+. 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') Requires Python 3.11 or later. Mailgun API credentials (domain and API key) must be provided. 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_current - Install friction: low - Maintenance: active - Downloads: 367.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags mailgun email api python, send emails with mailgun sdk, mailgun python wrapper, email delivery tracking python, mailgun async client, transactional email python, mailgun domain management, email-delivery, async-support, api-client [View on SkillFed](https://skillfed.io/packages/mailgun) · [View on PyPI](https://pypi.org/project/mailgun/)