guest@zmail:~$ cat README.md

self-hosted mail
for your domain

zmail runs SMTP, IMAPS, and mailing lists in one Go binary for Linux. Accounts, mailboxes, and the delivery queue live in local SQLite.

mail listeners

TCPserviceTLS
25incoming SMTPSTARTTLS in strict mode
465submissionimplicit TLS
587submissionSTARTTLS
993IMAPimplicit TLS
SMTP TLS policy
direct MX delivery
Send straight to recipient mail servers. The SQLite queue retries temporary failures for up to five days. Permanent failures generate an inbox delivery report.
DKIM and spam
Sign with RSA, Ed25519, or both. Verify inbound DKIM before scoring and route mail that reaches the configured threshold to Junk by default.
mailing lists
Run invite-only lists or open email signups. Manage moderation, bounce handling, and optional archives from the CLI.
one account
Use the same full email address and password for authenticated SMTP submission and IMAP over TLS.

Download the Linux amd64 release or build from the source checkout with Go 1.26 or newer.

shell

# from the source checkout

CGO_ENABLED=0 go build -o zmail ./cmd/zmail

# as the service user, after configuration

zmail -config zmail.yaml check
zmail -config zmail.yaml serve
download zmail.example.yaml
  1. Configure the hostSet the hostname and hosted domain in YAML. Use a dedicated service user and a PEM certificate and key for the mail hostname.
  2. Create accounts and a DKIM keyCreate the configured postmaster account. Set the DKIM selector and key path in YAML, then publish the generated TXT record.
  3. Set DNS and open the mail portsSet MX, A or AAAA, PTR, SPF, and DMARC records. Public mail delivery requires inbound and outbound TCP 25.
First-run commands

Install the binary on your path and save the example as zmail.yaml in a private directory owned by the service user. Run these commands from that directory, substituting your domain and configured postmaster address.

umask 077
mkdir -p keys
zmail dkim generate -key keys/example.com-mail.pem example.com mail
zmail -config zmail.yaml account create postmaster@example.com
zmail -config zmail.yaml check

On Linux, grant the installed binary CAP_NET_BIND_SERVICE to bind the standard mail ports as the service user, or use higher listener ports for a private installation.

SMTP TLS policy. The default strict policy requires STARTTLS on port 25 and verifies certificates for outbound MX peers. The public-mx setting allows plaintext when a peer omits STARTTLS and accepts peer certificates without public trust validation. Client submission and IMAP always require TLS.

diagnostics

zmail status
zmail queue history -limit 50
zmail spam list -limit 50

list administration

zmail list show dev@example.com
zmail list pending ls dev@example.com
zmail list bounces dev@example.com