Comprehensive, lightweight, and high-performance mail server based on Alpine Linux 3.19. Designed for speed, security, and ease of management.
- Full Stack: Postfix, Dovecot, MariaDB, Rspamd, and Nginx.
- Webmail Options: Built-in Roundcube and SnappyMail.
- ActiveSync: Z-Push support for mobile synchronization.
- Security: Integrated Fail2ban, OpenDKIM, and Rspamd for spam filtering.
- Admin Panel: Custom MailAdmin UI for easy domain and mailbox management.
- Performance: Optimized TCP stack and lightweight Alpine footprint.
- Auto-SSL: Built-in Let's Encrypt support via Certbot.

<!-- slide -->

<!-- slide -->

<!-- slide -->

<!-- slide -->

Important
This repository does not include the mailadmin binary. You must download the latest release from the MailAdmin repository and place it in rootfs/opt/mailadmin/mailadmin before building the Docker image.
To run the mail server, use the following command:
docker run -d \
--name mailserver \
--restart unless-stopped \
-v /opt/mailserver/data:/data \
-v /opt/mailserver/certs:/etc/letsencrypt \
-e MARIADB_USER=postfix \
-e MARIADB_PASS=password \
-e SETUP_PASSWORD=admin \
-e MAIN_DOMAIN=example.com \
-e MAIL_SERVER=mail.example.com \
-p 25:25 -p 80:80 -p 443:443 -p 465:465 -p 587:587 -p 993:993 -p 4190:4190 -p 9999:9999 \
kirpich/mailserver| Port | Protocol | Service | Description |
|---|---|---|---|
| 25 | TCP | SMTP | Mail transfer between servers |
| 80/443 | TCP | HTTP/S | Webmail and Admin UI |
| 465 | TCP | SMTPS | Secure SMTP (Submission) |
| 587 | TCP | STARTTLS | SMTP Submission |
| 993 | TCP | IMAPS | Secure IMAP access |
| 4190 | TCP | SIEVE | Remote Sieve management |
| 9999 | TCP | ADMIN | MailAdmin custom panel |
For your mail server to work correctly and not end up in spam, you MUST configure these records in your DNS:
- MX Record:
example.com. IN MX 10 mail.example.com. - A Record:
mail.example.com. IN A <Your-IP> - SPF (TXT):
v=spf1 mx a -all - DKIM (TXT): Get the public key from the Admin UI or
/data/dkim/mail.txtand add it as a TXT record formail._domainkey. - DMARC (TXT):
_dmarc IN TXT "v=DMARC1; p=none; rua=mailto:admin@example.com"
| Variable | Description | Default |
|---|---|---|
MAIN_DOMAIN |
Your primary mail domain | example.com |
MAIL_SERVER |
FQDN of the mail server | mail.example.com |
MARIADB_USER |
Database user for mail services | postfix |
MARIADB_PASS |
Database password | password |
SETUP_PASSWORD |
Password for the MailAdmin panel | admin |
MESSAGE_SIZE |
Max email size (bytes) | 52428800 |
UPLOAD_SIZE |
PHP Upload Max Filesize | 25M |
All important data is stored in the /data volume (map this to a persistent path on your host):
/data/mail: Mailboxes (vmail storage)/data/mysql: MariaDB databases and system tables/data/cert: Let's Encrypt certificates/data/dkim: OpenDKIM keys and configs/data/rspamd: Spam filtering rules, Bayes databases, and maps/data/fail2ban: Security logs and sqlite database
To update to the latest version, run:
docker pull kirpich/mailserver
docker stop mailserver
docker rm mailserver
# Re-run your start command or scriptNote
If you are using the source repository, you can use the included update.sh (for regular updates) or upgrade.sh (for database migrations) helper scripts.
Warning
Never commit real passwords, domains, or IP addresses to this repository. All sensitive data should be passed via environment variables or handled outside of version control.
If you have accidentally committed sensitive data, please follow these steps:
- Change all compromised passwords and keys immediately.
- Use tools like
git filter-repoor BFG Repo-Cleaner to remove sensitive data from your git history. - Update your local and remote repositories.
This project is licensed under the MIT License - see the LICENSE file for details.