Bonzo: SMTP Server built on top of Tornado

John Bonham's sigil three intersecting circles

About

Bonzo is an asynchronous SMTP server built on Tornado. It started as a port of Python’s old smtpd module and now uses Tornado’s native async/await APIs.

Hello, world

Here is a simple “Hello, world” example SMTP server for Bonzo:

import asyncio
import bonzo.smtp


class Handler(bonzo.smtp.RequestHandler):

    async def data(self):
        print(self.request.message)


async def main():
    application = bonzo.smtp.Application(Handler)
    application.listen(2525)
    await asyncio.Event().wait()


if __name__ == '__main__':
    asyncio.run(main())

Installation

Use pip to install Bonzo:

$ pip install bonzo

Or install from the latest source:

$ pip install git+https://github.com/puentesarrin/bonzo.git

Documentation

Sphinx is needed to generate the documentation:

$ python -m sphinx -W --keep-going -b html docs docs/_build/html

Install the development tools and run the test suite with tox:

$ python -m pip install -e ".[dev]"
$ tox

Run the same tests directly with unittest:

$ python -m unittest discover -s tests -p '*_test.py'

To test against specific Python interpreters installed on your machine:

$ tox -e py39,py310,py311,py312,py313,pypy3

Also, the current documentation can be found at ReadTheDocs.

License

Bonzo is available under the Apache License, Version 2.0.

Indices and tables

Note

Logo credits: Image created by Freakofnurture (Wikimedia user), released into the public domain (source).