Skip to content
A reimplementation of the Python stdlib based on asyncio.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
_static Reorganize the documentation. May 16, 2016
aiosmtpd Version bump Sep 1, 2018
examples Add docstring to Controller, explaining dual-stack binding. (#141) Jun 16, 2018
.coverage.ini Drop Python 3.4 support. May 16, 2017
.travis.yml Use codecov Mar 2, 2019 We need to globally ignore .gitignore Jun 26, 2017
README.rst Add a manpage. (#117) Jul 1, 2017 Improve the documentation for the STARTTLS options (#126) Aug 3, 2017
setup.cfg Initial commit. Jun 9, 2014 Bump to version 1.1 Jul 6, 2017 Very basic project skeleton. Sep 26, 2015
tox.ini Merge branch 'master' into drop34. May 29, 2017
unittest.cfg Handle lost connections and EOF during readlines (#73) Apr 27, 2017


aiosmtpd - An asyncio based SMTP server

The Python standard library includes a basic SMTP server in the smtpd module, based on the old asynchronous libraries asyncore and asynchat. These modules are quite old and are definitely showing their age. asyncore and asynchat are difficult APIs to work with, understand, extend, and fix.

With the introduction of the asyncio module in Python 3.4, a much better way of doing asynchronous I/O is now available. It seems obvious that an asyncio-based version of the SMTP and related protocols are needed for Python 3. This project brings together several highly experienced Python developers collaborating on this reimplementation.

This package provides such an implementation of both the SMTP and LMTP protocols.


You need at least Python 3.5 to use this library. Both Windows and *nix are supported.


aiosmtpd is released under the Apache License version 2.0.

Project details

As of 2016-07-14, aiosmtpd has been put under the aio-libs umbrella project and moved to GitHub.

The best way to contact the developers is through the GitHub links above. You can also request help by submitting a question on StackOverflow.


You can install this package in a virtual environment like so:

$ python3 -m venv /path/to/venv
$ source /path/to/venv/bin/activate
$ python install

This will give you a command line script called smtpd which implements the SMTP server. Use smtpd --help for details.

You will also have access to the aiosmtpd library, which you can use as a testing environment for your SMTP clients. See the documentation links above for details.


You'll need the tox tool to run the test suite for Python 3. Once you've got that, run:

$ tox

Individual tests can be run like this:

$ tox -e py35-nocov -- -P <pattern>

where <pattern> is a Python regular expression matching a test name.

You can also add the -E option to boost debugging output, e.g.:

$ tox -e py35-nocov -- -E

and these options can be combined:

$ tox -e py35-nocov -- -P test_connection_reset_during_DATA -E


.. toctree::
   :maxdepth: 2


Indices and tables

You can’t perform that action at this time.