Use DMA instead of sendmail
DragonFly Mail Agent (included with FreeBSD 11) allows us to replace Sendmail when we only need our server/desktop to send an email.
$: doas sysrc sendmail_enable=NONE
$: doas service sendmail onestop
$: doas nano /etc/mail/mailer.conf =>
# Execute dma instead of sendmail
sendmail /usr/libexec/dma
mailq /usr/libexec/dma
newaliases /usr/libexec/dma
rmail /usr/libexec/dma
$: doas nano /etc/periodic.conf =>
# Disable some sendmail specific daily maintenance routines
daily_clean_hoststat_enable="NO"
daily_status_mail_rejects_enable="NO"
daily_status_include_submit_mailq="NO"
daily_submit_queuerun="NO"
What remains is the configuration of DMA—here is an example for a Gmail account:
$: doas nano /etc/dma/dma.conf =>
SMARTHOST smtp.gmail.com
PORT 587
SECURETRANSFER
STARTTLS
AUTHPATH /etc/dma/auth.conf
MASQUERADE '<login-name>@gmail.com
$: doas echo '<login-name> | smtp.gmail.com: <login-password>'> /etc/dma/auth.conf