Skip to main content

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.

Example:

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

Install

pip3 install mailtest

Configuration

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

Speed

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

Testing

$ python2 test.py
..
----------------------------------------------------------------------
Ran 2 tests in 0.269s

OK
$ python3 test.py
..
----------------------------------------------------------------------
Ran 2 tests in 0.543s

OK

Release files for mailtest 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mailtest 1.1.3
File Size Uploaded
mailtest-1.1.3.tar.gz 2.8 kB Details

Release files / mailtest-1.1.3.tar.gz

Download URL mailtest-1.1.3.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6affa0e4a7f3de5f029731827cfa0fae9d45751aefb67d773ebbe2dee13ef80d
BLAKE2b-256 checksum
How to use checksums
0b849fef9cb5d64f469858b202b084e97398ec8930c43758840b16a4c4fa44a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.1.3 This release

1 release file

1.1.2

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page