Wednesday, 10 February 2021

Basic SMTP only configuration for FastMail on FreeBSD

dma is installed in base, so:

# Edit /etc/dma/dma.conf 

SMARTHOST smtp.fastmail.com
PORT 465
AUTHPATH /etc/dma/auth.conf
SECURETRANSFER
MAILNAME your.example.server

# Create an application password in FastMail for sending SMTP.

# Create /etc/dma/auth.conf containing

youremail@fastmail.com|smtp.fastmail.com:AppPassword

# Set dma as the default mailer

cp /etc/mail/mailer.conf /etc/mail/mailer.conf.orig
cp /usr/share/examples/dma/mailer.conf /etc/mail/mailer.conf

Make sure permissions are correct

chmod 640 /etc/dma/dma.conf /etc/dma/auth.conf
chown root:mail /etc/dma/dma.conf /etc/dma/auth.conf

Disable sendmail in /etc/rc.conf

sendmail_enable="NONE"

Send a test message

echo hello | mail -v -s test youremail@fastmail.com

Edit /etc/aliases and set root: to point to youremail@fastmail.com