Skip to main content

A unit testing tool for code that sends email.

Project description

MailTest is a Python unittesting library that for code that sends email. It starts a local SMTP server inside a Python with block, and captures all the email sent to it. These emails can then be read within the block.


with mailtest.Server() as mt:
    assert len(mt.emails) == 1


pip3 install mailtest


Configuration is done via kwargs to mailtest.Server(). Options: - smtp_port (defaults to 1025) - sendgrid_port (TODO)


MailTest can test receive approx. 4000 emails/second on an Intel(R) Core(TM) i5-7260U CPU @ 2.20GHz.


$ python2
Ran 2 tests in 0.269s

$ python3
Ran 2 tests in 0.543s


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for mailtest, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size mailtest-1.0.0.tar.gz (2.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page