Mox is a modern, open-source mail server written in Go that aims to make self-hosting email straightforward. It implements SMTP, IMAP, SPF, DKIM, DMARC, DANE, MTA-STS, autoconfig, and a webmail interface — all in a single binary with automatic TLS. Mox represents the latest generation of mail server software with security-first design and operational simplicity.
Why Mox?
- Single binary — one Go binary handles everything: SMTP, IMAP, webmail, admin
- Security by default — DANE, MTA-STS, strict TLS, automatic DKIM
- Built-in webmail — modern, fast webmail interface included
- Junk filter — Bayesian spam filter with reputation tracking
- Easy setup — interactive quickstart generates all DNS records
- Low resource usage — runs well on 512MB RAM
Installation
# Download latest release
MOX_VERSION=v0.0.11
wget https://github.com/mjl-/mox/releases/download/${MOX_VERSION}/mox-${MOX_VERSION}-linux-amd64.tar.gz
tar xzf mox-${MOX_VERSION}-linux-amd64.tar.gz
sudo mv mox /usr/local/bin/
sudo chmod +x /usr/local/bin/mox
Initial Setup
# Run the quickstart (generates configuration and DNS records)
sudo mox quickstart admin@example.com
# This creates:
# - config/mox.conf (main configuration)
# - config/domains.conf (domain configuration)
# - DKIM keys
# - List of required DNS records
# Review and apply the suggested DNS records before starting
Configuration
# config/mox.conf (generated by quickstart, customize as needed)
DataDir: data
Hostname: mail.example.com
AdminPasswordFile: adminpassword
Listeners:
public:
IPs:
- 0.0.0.0
Hostname: mail.example.com
TLS:
ACME: letsencrypt
SMTP:
Enabled: true
Submission:
Enabled: true
IMAP:
Enabled: true
IMAPS:
Enabled: true
AutoconfigHTTPS:
Enabled: true
WebmailHTTPS:
Enabled: true
AdminHTTPS:
Enabled: true
Postmaster:
Account: admin
Mailbox: Postmaster
DNS Records
The quickstart generates all required records. Apply them in your DNS provider:
# Generated by mox quickstart — example output:
mail.example.com. A 203.0.113.1
example.com. MX 10 mail.example.com.
example.com. TXT "v=spf1 mx -all"
# DKIM (mox generates multiple selectors)
20250115._domainkey.example.com. TXT "v=DKIM1; k=ed25519; p=..."
20250115e._domainkey.example.com. TXT "v=DKIM1; k=rsa; p=..."
# DMARC
_dmarc.example.com. TXT "v=DMARC1; p=reject; rua=mailto:dmarc@example.com"
# MTA-STS
_mta-sts.example.com. TXT "v=STSv1; id=20250115T000000Z"
# DANE (TLSA records)
_25._tcp.mail.example.com. TLSA "3 1 1 abc123..."
# Autoconfig/Autodiscover
_imaps._tcp.example.com. SRV 0 1 993 mail.example.com.
_submission._tcp.example.com. SRV 0 1 587 mail.example.com.
Managing Accounts
# Add a new account
mox config account add user@example.com
# Set password
mox config setaccountpassword user@example.com
# List accounts
mox config account list
# Add an email alias
mox config alias add info@example.com user@example.com
Systemd Service
# /etc/systemd/system/mox.service
[Unit]
Description=Mox Mail Server
After=network.target
[Service]
Type=notify
ExecStart=/usr/local/bin/mox serve
WorkingDirectory=/opt/mox
Restart=on-failure
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
ProtectSystem=strict
ReadWritePaths=/opt/mox/data
[Install]
WantedBy=multi-user.target
Web Interfaces
- Webmail:
https://mail.example.com/webmail/— full-featured webmail for users - Admin:
https://mail.example.com/admin/— server administration, queue management, logs - Account:
https://mail.example.com/account/— user self-service (password change, device security)
Junk Mail Filtering
Mox includes a Bayesian junk filter that learns from user behavior:
- Moving messages to Junk trains the filter as spam
- Moving messages from Junk to Inbox trains as ham
- The filter uses per-account reputation tracking
- SPF, DKIM, and DMARC results influence the junk score
Monitoring and Maintenance
# Check server status
mox config check
# View mail queue
mox queue list
# Retry queued messages
mox queue retry
# View delivery logs via admin interface
# https://mail.example.com/admin/ → Delivery logs
# Check TLS certificate status
mox config checkdomain example.com
Backup
# Mox stores everything in the data directory
# Back up the entire mox directory
tar czf /backup/mox-$(date +%Y%m%d).tar.gz /opt/mox/
# Or use mox built-in backup
mox backup /backup/mox-$(date +%Y%m%d)/
Best Practices
- Use the quickstart to generate configuration and DNS records — it handles complex setups automatically
- Enable DANE (TLSA records) for the strongest transport security
- Mox signs outgoing email with both Ed25519 and RSA DKIM keys for maximum compatibility
- Set DMARC policy to reject once you have verified email authentication works correctly
- Monitor the admin dashboard for delivery issues and junk filter effectiveness
- Keep Mox updated — it is actively developed with security and feature improvements
- Use the built-in autoconfig for easy email client setup