June 5, 2016 tim 0Comment

In this tutorial we will be replacing sendmail with ssmtp to use an AOL email account for sending outgoing email via SSL. You can also use these instructions to do the same with Gmail, Yahoo, or any other SMTP account.


When performing this setup on my FreeBSD servers I have always used http://btt.red/b/2/0/freebsd-use-gmail-for-outgoing-mail for reference, however I am creating this tutorial to add additional steps that I find work best for my setups.


DO NOT USE your primary SMTP account with ssmtp, since the configuration requires storing the SMTP account password in plain text, you really want to use a separate account that serves no other purpose but sending outgoing email from FreeBSD. I also recommend changing the SMTP account password every 30-days.

Disable sendmail from system startup

# nano /etc/rc.conf 

add these lines


stop sendmail from running

# killall sendmail  

install ssmtp from the pkgng repo

# pkg install -y ssmtp

configure ssmtp for use with your SMTP account

# nano /usr/local/etc/ssmtp/ssmtp.conf

add these lines


update mailer.conf

# nano /etc/mail/mailer.conf 

change this

sendmail /usr/libexec/sendmail/sendmail
send-mail /usr/libexec/sendmail/sendmail
mailq /usr/libexec/sendmail/sendmail
newaliases /usr/libexec/sendmail/sendmail
hoststat /usr/libexec/sendmail/sendmail
purgestat /usr/libexec/sendmail/sendmail 

to this

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

set up a reverse aliases

# nano /usr/local/etc/ssmtp/revaliases 

add this line (change this according to your SMTP account settings)


change root’s Full Name using chpass
we will set nano as the default text editor otherwise chpass will open with vi.

# setenv  EDITOR  nano

edit the line Full Name to something other than Charlie & (help prevents email from ending up in spam folder)

I normally set this to my servers host name so I know what server sent me the message (I use ssmtp to email the results of all cron jobs that run on my servers)

# chpass


Full Name: Charlie &


Full Name: server22.debarbora.com # (or what ever you want to call it)

Now we test

# mail -v -s "subject line" anotheremail@domain.com

enter a message, than enter to go down a line


CTRL+D to send the message