Update 11/25/21: Having been asked by a few people about the next version of qmail I have decided to go with s/qmail for a few reasons. This works on FreeeBSD 12 but this is still a work in progress. I am testing the guide but it will probably be the first quarter in 2022 that this will be finished. I am hoping some of you will reach out with any input or suggestions.

This updated version of qmail will include the installation of s/qmail. s/qmail is a complete refactoring of the source code according to current demands for 64-bit systems and including IPv6 capabilities.

s/qmail uses D. J. Bernstein's 'C' coding principles entirely.
Full IPv6 compliance: Allow specific IPv6 bindings to any IPv6 address (even LLU) for all servers and clients (qmail-smtpd, qmail-qmqtpd; qmail-remote, qmail-smtpam, qmail-qmqpc).
Unlike the original version, qmail-remote works multi-tenant, thus supporting different domains and senders with particular sending attributes (e.g. IP addresses, authentication, certificates) as well as providing particular bounce delivery, together with QMTP and QMTPS client capabilities.
Distributed queueing: with qualified authentication and authorization (enhanced 'QMQ').
TLS enabling of most servers and particular clients for SMTP and QMTP as well as POP3.
LibreSSL and OpenSSL (1.1) and comes with ucspi-ssl (0.99) .
s/qmail allows 'opportunistic' as well as mandatory TLS encryption together with easy X.509 certificate pinning.
Compliance with John Levin's RFC 7505.
SPF capabilities have been added for qmail-smtpd based on Jana Saout's development (used by permission); of course with full IPv6 support.
SMPTUTF8 [RFC 6532] together with International Domain Names (aka E-mail Address Internationalisation -- EAI ) is now supported by s/qmail provided the libidn2 is available.
Conformance with the recent RFC 8314 ('Cleartext Considered Obsolete: Use of Transport Layer Security (TLS) for Email Submission and Access') even if former RFCs violated those principles.
Together with ucspi-ssl (0.10.x) s/qmail is TLS 1.3 [RFC 8446] capable, provided OpenSSL 1.1.1 is installed and the respective ucspissl.a lib is build on top of it.
SRS is natively supported with the modules srsforward and srsreverse used in a dot-qmail file.

This installation method has completely changed. Some of the installs like daemontools have been moved to the preinstall and there is a new method of installing qmail using s/qmail. This guide is in testing mode only for the time being. This has been tested on 11.2 and 11.3 but 12.x remains to be seen.

Please make sure your ports system is up-to-date.

We need to install Curl then install the rest of the required ports:


# cd /usr/ports/ftp/curl
# make install clean

Shortly after this starts installing, you will get a popup box that has in it:


Options for ca_root_nss x.x.x
[X] ETCSYMLINK Add symlink to /etc/ssl/cert.pem

Make sure that box is checked by hitting the space bar and then hit tab and hit enter.
Bash Shell


# cd /usr/ports/shells/bash
# make install clean

Unzip


# cd /usr/ports/archivers/unzip
# make install clean

Wget


# cd /usr/ports/ftp/wget
# make install clean

Bind Tools


# cd /usr/ports/dns/bind-tools
# make install clean

Lets make sure Perl 5.xx is installed


# pkg info | grep perl

If it returns something like the following (Version may vary) then you're all good!


perl5-5.32.x Practical Extraction and Report Language

Now lets make sure gmake is installed


# pkg info | grep gmake

If it returns something like the following (Version may very) then you're all set!


gmake-4.2.1_3 GNU version of 'make' utility

THE FOLLOWING PORT WILL NEED TO BE INSTALLED ONLY IF YOU ARE TESTING 12 CURRENT:
groff


# cd /usr/ports/textproc/groff
# make install clean

When the popup box comes up for groff uncheck the option for X11 devices.
You will need to install apache for webmail but you should install mysql for the Rainloop Address Book database:

Apache 2.4 or better with SSL and PHP 7.3 (SSL is HIGHLY recommended)
Mysql Server 5.6 or Higher
Certbot

If you would like to create a queuing server please check out the following link:

How to create a queing server

A few of John Simpson's scripts use a link to perl which doesn't exist on FreeBSD so we need to create a symlink to it as follows:


# cd /usr/bin
# ln -s /usr/local/bin/perl perl

Type in the following commands to eliminate sendmail from being called on your box:


# killall sendmail
# mv /usr/sbin/sendmail /usr/sbin/sendmail.old
# chmod 0 /usr/sbin/sendmail.old

To tell FreeBSD not to tell sendmail to start on boot, add this to /etc/rc.conf like so:
NOTE: If you are running FreeBSD 12 CURRENT please use the following line:
sendmail_enable="NONE"


# echo "sendmail_enable=NONE" >> /etc/rc.conf
# echo "sendmail_submit_enable=NO" >> /etc/rc.conf
# echo "sendmail_outbound_enable=NO" >> /etc/rc.conf
# echo "sendmail_msp_queue_enable=NO" >> /etc/rc.conf

Now to tell sendmail not to interfere with your qmail setup, add this to your /etc/make.conf like so:


# echo "NO_SENDMAIL=yes" >> /etc/make.conf
# echo "NO_MAILWRAPPER=yes" >> /etc/make.conf

Now lets tell anything that calls sendmail from the common location that we want it to send to qmail instead:


# ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail
# ln -s /var/qmail/bin/sendmail /usr/lib/sendmail

Now we need to install gcc48, libsrs2 and libidn2


# cd /usr/ports/lang/gcc48
# make install clean
# cd /usr/local/bin
# ln -s gcc48 gcc
# cd /usr/ports/mail/libsrs2
# make install clean
# cd /usr/ports/dns/libidn2
# make install clean

If you are using periodic.conf for your system messages you should also disable clean-purgestat from it. Open up /etc/periodic.conf and edit the following line as follows:


# 150.clean-hoststat
daily_clean_hoststat_enable="NO" # Purge sendmail host