Simple SMTP server with basic mail receiving capabilities (for best experience use it with TOR, I2P or other privacy-oriented networks)

dymik739 22dcd6d32a added more info to README.md 2 years ago
.gitignore 19e79f463e first commit (already working) 2 years ago
LICENSE 19e79f463e first commit (already working) 2 years ago
README.md 22dcd6d32a added more info to README.md 2 years ago
server.py 4da4ed2dd6 fixed wrong sender address parsing 2 years ago

README.md

simple-smtp-server

Simple SMTP server with basic capabilities and (for best experience use it with TOR, I2P or other privacy-oriented networks)

How to host

Dependencies

Only python3 is required; all other modules (os, datetime, codecs and socket) come preinstalled with most packages.

Installation

This part is pretty easy and straightforward; you just need to download this repository and run server.py

git clone https://notabug.org/dymik739/simple-smtp-server.git
cd simple-smtp-server
python3 server.py

That's all you need to do! Now the server will be accessible on all network interfaces on port 2525. Of course, you can use it inside of a screen to make it more stable if it is hosted on a remote machine.

Configuration

All the configuration is done by creating and editing files in the config/ directory. Available options are listed below.

You can set a domain name the server will present to clients by writing it to config/domain file, for example:

printf "mydomain.org" > config/domain

You can change the port the server will listen to on by writing a port number to config/port file (requires server restart):

printf "25" > config/port

You also have an option to enable DEBUG level output by creating config/debug file (you can just leave it empty, content of this file doesn't matter):

touch config/debug

Most of these settings can be applied on the go without server restart (if not mentioned otherwise).

If you want to revert any of these settings, just delete the corresponding file and the server will set the default option automatically.

Reading incoming emails

Server itself does not provide any interfaces to see the messages; instead, they are written in separate files in the messages/ directory.

You can use any tool to read them (like cat, less, bat or other). To view all the messages at once using "bat" (fox example), you will run this command:

bat messages/*

As every single email is in it's own file, you can easily look through all of them using grep (or other program). That opens up a lot of possibilities to script or code anything you want around this server; you can even forward all the emails (or emails from particular address) directly to your phone!

This way of storing messages is also great for doing backups of all sort.

Further maintenance

To stop the server you can just press Ctrl+C and to start it again use python3 server.py or just ./server.py (whichever one you like more)

Updating the server is pretty easy as well: just run git pull command and wait a bit - it will automatically update your instance while keeping all your settings and messages intact (but it is never bad to make a backup anyway).

Something is broken!

If you encounter bugs, it doesn't start or run on your system or you stumble across other weird stuff - feel free to open an issue on this project's page! It would greately help to improve the project and you will get a working instance. (keep in mind - Windows is not supported)

Contributing

You can give any help you want! Bug reports, feature requests, pull requests and all other things can be used. Any help is appreciated! (one thing has to be mentioned - this project aims to be as minimal as possible, which means that it should only receive and save mail; no decoding, no formatting, no other stuff that can be done by separate scripts)