One may find it necessary to configure sendmail to authenticate and relay via another SMTP server, such as one provided by your ISP. In order to do this under FreeBSD, sendmail needs to be rebuilt with support for SASL and a few config changes are required.
1. cd /usr/ports/security/cyrus-sasl2 && make install clean
Untick AUTHDAEMOND, OTP and NTLM.
2. Edit /etc/make.conf and add:
SENDMAIL_CFLAGS=-I/usr/local/include -DSASL=2
SENDMAIL_LDFLAGS=-L/usr/local/lib
SENDMAIL_LDADD=-lsasl2
3. Rebuild/reinstall sendmail:
cd /usr/src/lib/libsmutil;make cleandir && make obj && make
cd /usr/src/lib/libsm;make cleandir && make obj && make
cd /usr/src/usr.sbin/sendmail;make cleandir && make obj && make && make install
4. Create /etc/mail/authinfo with the following content (assuming your SMTP server supports PLAIN auth within TLS):
AuthInfo:smtp.server.host “I:username” “P:password” “M:PLAIN”
5. cd /etc/mail && makemap hash authinfo<authinfo;chgrp smmsp authinfo*;chmod o-rwx authinfo*
6. cp freebsd.submit.mc `hostname`.submit.mc;cp freebsd.mc `hostname`.mc
7. Edit /etc/mail/`hostname`.submit.mc and /etc/mail/`hostname`.mc and add the following before the msp line:
FEATURE (`authinfo’)
define(`SMART_HOST’, `smtp.server.host’)
8. /etc/rc.d/sendmail stop && /etc/rc.d/sendmail start
9. Profit!