using ssmtpd

The standard FreeBSD installation uses sendmail as an MTA. Since only administrative mail needs to be sent via a provider getway, this is a little bit of overkill. Instead of using a full featured MTA, ssmtp should be used.

remove sendmail

add these lines to rc.conf:

sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"

install ssmtp

remote> sudo pkg install ssmtp

change /etc/mailer/mailer.conf

sendmail    /usr/local/sbin/ssmtp
send-mail   /usr/local/sbin/ssmtp
mailq       /usr/local/sbin/ssmtp
newaliases  /usr/local/sbin/ssmtp
hoststat    /usr/bin/true
purgestat   /usr/bin/true

setting reverse aliases

remote> sudo cp /usr/local/etc/ssmtp/revaliases.sample /usr/local/etc/ssmtp/revaliases
remote> sudo vim /usr/local/etc/ssmtp/revaliases

add this line:

root:root_email@example.com:smtp.example.com

setup in ssmtp.conf

root=root_email@example.com
mailhub=smtp.example.com:465
rewriteDomain=example.com
FromLineOverride=YES
UseTLS=YES
Debug=NO

# username and password for smtp
AuthUser=<username>
AuthPass=<password>
AuthMethod=LOGIN

Last edited on 2018-02-28