mail-server (mail/mail-server) Updated: 1 year, 6 months ago Add to my watchlist

Mail server configuration

Mail server working configuration that provides a basic, working, easily modifiable mail server. The configuration is built using postfix for the MTA, dovecot for the MDA, solr for fast search, rspamd for a milter, and clamav for email virus scans. The configuration includes a surrogate TLS certificate, DKIM, and Apple Push Notification Service (APNS) capability for iOS devices.

Version: 1.5 License: GPL-3 GitHub
Maintainers essandess
Categories net mail
Platforms darwin
  • initialize_always (Always initialize all configuration files. Intended for development and troubleshooting only. Working deployments must disable this variant to prevent configuration files being overwritten at the next upgrade. Existing configuration files are not overwritten by default.)
  • logrotate (Use mail-server logrotate configuration.)

"mail-server" depends on

lib (13)
run (1)
build (1)

Ports that depend on "mail-server"

Port notes

A mail server is a complex, interdependent set of tools that must all be configured correctly to provide secure, reliable email.

Users must reconfigure this installation for their own system, network, and security model specifics by editing all necessary files and checking file permissions. A subset of these settings are visible in the files:

port contents mail-server
port file mail-server

Full deployment also requires a working DNS configuration on both the LAN and the internet, including SPF and DKIM records, trusted TLS certificates, port forwarding, possibly a mail replay, and more.

Postfix and dovecot must be installed with these variants:
sudo port -pN install postfix +dovecot_sasl+pcre+smtputf8+tls
sudo port -pN install dovecot +solr [+apns]

These are the locations and network settings for the default configuration:

MTA (postfix):
ports: smtp/tcp (25), submission/tcp (587)

MDA (dovecot):
port: imaps/tcp (993)

FTS (solr):

Milter (rspamd):

A default Rspamd controller password and its hash appear in the files:

Rspamd controller:

Spam/Ham training (default behavior):
Move/Copy email to the folders Spam_train or Notspam_train.

The configuration also includes a surrogate TLS certificate and DKIM settings that must be changed before deployment.



The ports dns-server provide necessary DNS service on the LAN; variant +logrotate provides log rotation capabilities:

sudo port install dns-server
sudo port install mail-server +logrotate

This port assume indepedent installation and management of DNS and log rotation; mail-server includes example logrotate configuration files and a logroate launchdaemon.

The port's launch daemon controls launching for each of the dependendent services. These may be controlled independently, e.g.

sudo port load clamav-server
sudo port load apache-solr8
sudo port load redis
sudo port load dcc
sudo port load postfix
sudo port load dovecot
sudo port load rspamd

and if installed independently,

sudo port load dns-server
sudo port load logrotate

TLS certificate updates must be included in mail-server dovecot's conf.d/10-ssl.conf, postfix's, and, if installed, calendar-contacts-server's proxy nginx.conf. Instructions are included as comments in:

sudo vi ${prefix}/etc/dovecot/conf.d/10-ssl.conf
sudo vi ${prefix}/etc/postfix/
sudo vi \

* _The Book of Postfix_, by Patrick Koetter and Ralf Hildebrandt

Known issues:
* The Postfix service does not reliably start after reboot, presumably due to an issue with launchd. A workaround after rebooting is to issue the commands:

sudo port unload postfix ; sleep 5 ; sudo port load postfix Startup items (named 'mail-server.logrotate, mail-server') have been generated that will aid in starting mail-server with launchd. They are disabled by default. Execute the following command to start them, and to cause them to launch at startup:

sudo port load mail-server

Port Health:

Loading Port Health

Installations (30 days)


Requested Installations (30 days)