aiosmtpd
aiosmtpd - asyncio based SMTP server
What it is and what it does
aiosmtpd is an asyncio-based SMTP server implementation that replaces the synchronous smtpd module from Python's standard library. It allows you to build email servers and mail transport agents (MTAs) that can handle multiple concurrent SMTP connections without blocking. The package is built on asyncio, making it suitable for integration into async Python applications that need to receive, process, or relay email messages.
The server implements SMTP and related MTA protocols, letting you define custom handlers for incoming mail. It runs on Windows, Linux, FreeBSD, and supports both CPython and PyPy across Python 3.8 through 3.12. With only two runtime dependencies (atpublic and attrs), it has minimal overhead and integrates cleanly into existing async codebases.
Use it for:
- Build a test SMTP server for development and integration testing of email-sending applications.
- Implement a mail relay or gateway that receives SMTP connections and forwards messages to downstream systems.
- Create a custom email processing pipeline that captures incoming messages for logging, filtering, or transformation.
- Run a local SMTP listener for development environments to intercept and inspect outgoing mail without sending it.
- Integrate email reception into an async web application or microservice architecture.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
aiosmtpd is an asyncio-based SMTP server that handles email message reception and routing, similar to the standard library's smtpd module but built for concurrent async workloads.
Yes. aiosmtpd is actively maintained, permissively licensed, has low install friction, and fills a genuine gap for async SMTP server use cases. It's well-suited for testing, prototyping, and production email reception in async Python applications. No known vulnerabilities as of the fact sheet date.
Install
aiosmtpd on PyPI
pip
pip install aiosmtpduv
uv add aiosmtpdpoetry
poetry add aiosmtpdInstalling aiosmtpd
Before you install
Low install friction with only two lightweight runtime dependencies (atpublic and attrs). The package is actively maintained with a recent commit as of 2026-08-12, supports Python 3.8 through 3.12, and has been in development since 2015-10-20.
License in practice
Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions—suitable for most deployment scenarios.
Quickstart
pip install aiosmtpd
import asyncio
from aiosmtpd.smtp import SMTP
async def main():
smtp = SMTP()
await smtp.handle_EHLO(None, None)
asyncio.run(main())
Requires Python 3.8 or later; asyncio event loop must be available in the runtime environment.
Verify before relying
- Whether the package includes built-in handlers for common mail delivery scenarios or requires custom handler implementation.
- Performance characteristics under high concurrent connection loads.
- Compatibility with modern mail client authentication schemes (SASL, TLS).
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — atpublic, attrs |
| Maintenance | actively maintained — 818 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,895,655/month — #3,453 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: aiosmtpd-1.4.6-py3-none-any.whl
Keywords: email, smtpd, smtp
Tags
More Mail Transport Agents packages
Implements DKIM (DomainKeys Identified Mail)…
permissive · top 5,000 on PyPI
authheadersGenerates and validates email authentication…
permissive · top 15,000 on PyPI
aiosmtplibaiosmtplib is an asynchronous SMTP client that…
permissive · top 5,000 on PyPI
yagmailSimplifies sending emails via Gmail or any SMTP…
permissive · top 15,000 on PyPI
fastapi-mailSends emails and attachments asynchronously…
permissive · top 5,000 on PyPI
redmailRedmail simplifies sending emails with Python…
permissive · top 15,000 on PyPI
apache-airflow-providers-smtpAdds SMTP email sending capabilities to Apache…
permissive · top 5,000 on PyPI
mailosaurMailosaur is a Python client library for…
permissive · top 15,000 on PyPI
mailsuitemailsuite retrieves, parses, and sends emails…
permissive · top 15,000 on PyPI
aiogoogleAiogoogle is an async Python client for…
permissive · top 5,000 on PyPI
Flask-MailFlask-Mail adds email-sending functionality to…
permissive · top 5,000 on PyPI
emailsBuild and send HTML and plain-text emails with…
permissive · top 15,000 on PyPI