Giter VIP home page Giter VIP logo

nullsmtp's Introduction

nullsmtp

Build Status

nullsmtp 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/nullsmtp, 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

nullsmtp relies on Python 3.3+ and just its standard library. Recommended to also have pip for installation.

Installation

Recommended Installation is through PyPi:

pip install nullsmtp

Or if you've cloned the repository:

python3 setup.py install

Usage

usage: nullsmtp [-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 nullsmtp 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
                        ~/.nullsmtp)
  -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/nullsmtp, 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:

nullsmtp.log
[email protected]/
    [email protected]
    [email protected]
    [email protected]
[email protected]/
    [email protected]

where nullsmtp.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).

nullsmtp's People

Contributors

masterodin avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.