Personal Mail server
Go to file
Balakrishnan Balasubramanian 64dcc74b8d Merge pull request 'Makefile cleanup' (#7) from cleanup into main
Reviewed-on: #7
2024-04-17 20:41:13 -04:00
deploy_configs Improve cert_copy script to work better for the first time 2024-04-01 18:11:38 -04:00
mail4one make file improvements and some pylint cleanup 2024-04-16 18:14:09 -04:00
scripts Remove type information files from executable 2024-01-12 10:48:17 -05:00
tests Add option to not enforce starttls and smtputf8 2024-04-16 18:06:16 -04:00
.gitignore reorg files 2023-06-28 17:15:18 -04:00
LICENSE Add LICENSE 2018-12-18 17:12:08 +00:00
Makefile add test target 2024-04-16 18:14:09 -04:00
Pipfile add jata 2023-05-12 16:49:51 -04:00
Pipfile.lock Upgrade dependencies 2024-04-01 18:12:44 -04:00 Improve readme doc 2024-01-09 11:25:42 -05:00
requirements.txt Upgrade dependencies 2024-04-01 18:12:44 -04:00


Personal mail server for a single user or a small family. Written in pure python with minimal dependencies. Designed for dynamic alias based workflow where a different alias is used for each purpose.

Getting started

  1. Get a domain name
  2. Get a VPS (or a home server). Setup firewall rules for receive on port 25, 995, 465
  3. Setup MX record
  4. Build / Download latest release - mail4one.pyz
  5. Generate config.json from config.sample
  6. Run ./mail4one.pyz -c config.json
  7. Setup systemd service and TLS certificates. See deploy_configs for examples

Sending email

Mail4one only takes care of receiving and serving email. For sending email, use an external service like below

Most of them have generous free tier which is more than enough for personal use.

Sending email is tricky. Even if everything is correctly setup (DMARC, DKIM, SPF), popular email vendors like google, microsoft may mark emails sent from your IP as spam for no reason. Hence using a dedicated service is the only reliable way to send emails.


Original source is at

For issues, pull requests, discussions, please use github mirror:


See files under deploy_configs for configuring and deploying to a standard systemd based linux system (e.g. debian, ubuntu, fedora, archlinux etc). config.sample has inline comments for more details. Feel free create github issue/discussions for support.

DNS Records (Receiving)

If you want to receive email for and your VPS IP address is Following record needs to be created

Type Name Target Notes
AAAA abcd:1234::1234::1 Optional, add if available
MX Optional, to receive emails like

For sending emails DMARC, DKIM and SPF records need to be set. Please refer to email sending provider for details.

Building from source

Make sure to have make, git, python >= 3.9, and pip installed in your system and run below

make build

This should generate mail4one.pyz in current folder. This is a executable python archive. Should be runnable as ./mail4one.pyz or as python3 mail4one.pyz.

Roadmap (Planned features for future)

  • Other ways to install and update (PIP, AUR, docker etc)
  • Write dedicated documentation
  • Test with more email clients (Thunderbird and k9mail are tested now)
  • IMAP support
  • Web UI for editing config (WIP)
  • Support email submission from client to forward to other senders or direct delivery
  • Optional SPAM filtering
  • Optional DMARC,SPF,DKIM verification
  • Webmail Client
  • Web UI to view graphs and smart reports