GitXplorerGitXplorer
M

nullsmtpd

public
7 stars
5 forks
2 issues

Commits

List of commits on branch master.
Unverified
af4a9ca33488b328c33667a4ff212fe639176fc4

Fix install dependency to main package

MMasterOdin committed 7 years ago
Unverified
784312d38ecc751375706ddd999113722c8053b7

Fix requirements for python version

MMasterOdin committed 7 years ago
Unverified
9999745e1750dd456f4dba1a2a1ed1e7ea2de92a

Fix syntax error

MMasterOdin committed 7 years ago
Unverified
71bf162fbf31e2652640b000f2d19dcfffa4dfae

Merge branch 'master' of https://github.com/MasterOdin/nullsmtp

MMasterOdin committed 7 years ago
Unverified
9050e8799d533a0ec21a9b904080d116e066080d

Move to aiosmtpd and rename to nullsmtpd

MMasterOdin committed 7 years ago
Unverified
4fd584646a9f9cfaba91d63231a0d867c40fb8b2

Bump version

MMasterOdin committed 7 years ago

README

The README file for this repository.

nullsmtpd

.. image:: https://travis-ci.org/MasterOdin/nullsmtpd.svg?branch=master :target: https://travis-ci.org/MasterOdin/nullsmtpd :alt: 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 <https://github.com/aio-libs/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).