Skip to main content

nullsmtpd

Build Status

nullsmtpd is a fake SMTP server (written in python) which can be used for development. The server catches incoming mail, writes them to a file, and doesn’t actually send it out to the intended recipients. All emails are saved to a directory (defaults to /var/log/nullsmtpd, but can be changed via flag) where each email address sent to gets its own folder and then emails are stored in that folder named {sender}.{time}.msg. This is useful for debugging applications where you don’t want a GUI (as you’re running a headless VM say), but still actually need to see the messages that were sent in the system, without having to worry about things getting bounced or whatever.

Generally, you’d probably want to install this instead of something like sendmail or some other package that would handle sending mail from your server.

Requirements

nullsmtpd relies on Python 3.5+ and aiosmtpd. Recommended to also have pip for installation.

Installation

Recommended Installation is through PyPi:

pip install nullsmtpd

Or if you’ve cloned the repository:

python3 setup.py install

Usage

usage: nullsmtpd [-h] [--no-fork] [-H HOST] [-P PORT] [--mail-dir MAIL_DIR]
                [-v]

optional arguments:
  -h, --help            show this help message and exit
  --no-fork             Don't fork and run nullsmtpd as a daemon. Additionally,
                        this willprint all log messages to stdout/stderr and
                        all emails to stdout.
  -H HOST, --host HOST  Host to listen on
  -P PORT, --port PORT  Port to listen on
  --mail-dir MAIL_DIR   Location to write logs and emails (defaults to
                        ~/.nullsmtpd)
  -v, --version         show program's version number and exit

By default, you will need to use sudo as the server wants to bind itself to localhost and port 22. However, if you use a different port, then it will not require using sudo. However, note, that if the current running user of the script does not have access to create a directory/file within /var/log or /var/log/nullsmtpd, then no emails will be written to file, but just through the console.

If the mail directory is writeable to, then you should have the following directory structure:

nullsmtpd.log
person1@example.com/
    1492024232.person2@example.com.msg
    1492024462.person2@example.com.msg
    1493678462.person1@example.com.msg
person2@example.com/
    person1@example.com.1232421423.msg

where nullsmtpd.log a log file for the system, and then each folder represents a person’s “inbox” and inside are messages from someone at a given timestamp (seconds from epoch).

Metadata

Release files for nullsmtpd 0.5.1

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

Source distribution (sdist)

Source distribution for nullsmtpd 0.5.1
File Size Uploaded
nullsmtpd-0.5.1.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nullsmtpd 0.5.1
File Interpreter ABI Platform
nullsmtpd-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.8 kB

Release files / nullsmtpd-0.5.1.tar.gz

Download URL nullsmtpd-0.5.1.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1cb34a1200b95115e8c021e721b57b2918c403c42df2d5a9ef50c9556e1f5fa3
BLAKE2b-256 checksum
How to use checksums
95174853581b580d3fd9076054eed471495cebfce8c7705ac8d4f50a0ee2a1ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / nullsmtpd-0.5.1-py3-none-any.whl

Download URL nullsmtpd-0.5.1-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ffaa3769655bc287c42c1909b993c3cb99ecffd8a0533a4e1271328b749a4cc
BLAKE2b-256 checksum
How to use checksums
92847e77946f3d97ec966fbebd31ebc935d98f257e931612fb76d38f680783fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files

0.5.0

1 release file

0.4.1

1 release file

0.4.0

2 release files

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