Sign inSign up

kirpich/mailserver

By kirpich

Updated 3 days ago

Full fledged mail server

Image
0

2.5K

kirpich/mailserver repository overview

Kirpich MailServer

Build Status Platform License

Source Code: GitHub Repository

Comprehensive, lightweight, and high-performance mail server based on Alpine Linux 3.19. Designed for speed, security, and ease of management.

🚀 Key Features

  • 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.

🛠 Quick Start

Important

This repository does not include the `mailadmin` binary. You must download the latest release from the [MailAdmin repository](https://github.com/kirpicheff/mailadmin) 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
🔓 Ports
PortProtocolServiceDescription
25TCPSMTPMail transfer between servers
80/443TCPHTTP/SWebmail and Admin UI
465TCPSMTPSSecure SMTP (Submission)
587TCPSTARTTLSSMTP Submission
993TCPIMAPSSecure IMAP access
4190TCPSIEVERemote Sieve management
9999TCPADMINMailAdmin custom panel

🌐 DNS Requirements

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.txt and add it as a TXT record for mail._domainkey.
  • DMARC (TXT): _dmarc IN TXT "v=DMARC1; p=none; rua=mailto:[email protected]"

⚙️ Environment Variables

VariableDescriptionDefault
MAIN_DOMAINYour primary mail domainexample.com
MAIL_SERVERFQDN of the mail servermail.example.com
MARIADB_USERDatabase user for mail servicespostfix
MARIADB_PASSDatabase passwordpassword
SETUP_PASSWORDPassword for the MailAdmin paneladmin
MESSAGE_SIZEMax email size (bytes)52428800
UPLOAD_SIZEPHP Upload Max Filesize25M

📁 Persistence

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

🔄 Updates

To update to the latest version, run:

docker pull kirpich/mailserver
docker stop mailserver
docker rm mailserver
# Re-run your start command or script

Note

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.

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

Tag summary

Content type

Image

Digest

sha256:39b272fbb

Size

215.4 MB

Last updated

3 days ago

docker pull kirpich/mailserver