Setup Email Server From Scratch On FreeBSD

 Intro -> 01 Server Setup

This tutorial is partially complete 2025-05-14
Postfix, Dovecot, & PostfixAdmin work with MySQL and virtual accounts
can be created with PostfixAdmin and used with an email client. SPF, OpenDKIM,
and DMARC milters, Roundcube with sieve filters and password plugins all work.
Roundcube kolab calendar works (2025-05-20)

My two favorite operating systems for servers are FreeBSD and Debian. In 1994 I switched from Linux to FreeBSD and after more development found I was unable to migrate my main project back to Linux (at that time). Fast forward 30 years. My website runs on FreeBSD with an Ubuntu bhyve virtual machine running Zimbra Mail. Forwarding ports with ipfw (kernel level firewall) to the internal VM is tricky, and a couple times a year the Zimbra VM stops working and needs to be rebooted. It would be better to install and run the email stack natively on the FreeBSD server. Years ago I tried the Purple Hat Maia install which rendered my server unusable and required a rebuild. There have been some requests in forums for updated mail install on a current version of FreeBSD.

In retrospect, now that I am on page 08 Create Virtual Domains, it might have been better to sacrifice ARGON2I encryption and MariaDB for mysql80-server so upgrades can be automated with pkg. With this setup pkg update pkg upgrade is trying to upgrades some packages and replace MariaDB even though I have specified maria in /etc/make.conf (this only affects ports). I'll leave this idea for the next version of this howto.

This tutorial is based on Linuxbabe - Build Email Server From Scratch on Debian and I got everything working on a Debian 12.8 machine with updates before starting on FreeBSD. I have matched the Debian installation with comparable packages and configurations on FreeBSD. I don't pretend to know what I am doing all of the time, and so there is some trial and error.

Note that mixing packages and ports is generally discouraged, but everything in this tutorial has been tested and works. I am not going to use any images for this initially and will use text files from a knowledgebase for simplicity. Once everything is working and documented, I'll go back and make it pretty. Maybe ...


01 Server Setup
02 FAMP Install
03 Postfix SMTPD
04 Dovecot IMAP
05 PostfixAdmin
06 SPF DMARC And DKIM
07 RoundCube WebMail
08 Create Virtual Domains
09 Blocking Spam
25 IMAPSYNC
99 FreeBSD NAT64 Router

 Intro -> 01 Server Setup