Forward Mail to Gmail

This article describes how to change FreeBSD's default MTA from Sendmail to sSMTP, and then forward root's mail to Gmail.

 

Begin by stopping any running Sendmail processes

service sendmail stop

Then disable Sendmail by adding the following line to /etc/rc.conf

sendmail_enable="NONE"

 

Install sSMTP from ports

cd /usr/ports/mail/ssmtp
make install replace clean

 

Create a new /usr/local/etc/ssmtp/ssmtp.conf with the following configuration:

root=This email address is being protected from spambots. You need JavaScript enabled to view it. 
mailhub=smtp.gmail.com:587
AuthUser=This email address is being protected from spambots. You need JavaScript enabled to view it.
AuthPass=yourpassword
UseSTARTTLS=YES

 

Edit this section at the top of /etc/mail/aliases

# Pretty much everything else in this file points to "root", so
# you would do well in either reading root's mailbox or forwarding
# root's email from here.

root:This email address is being protected from spambots. You need JavaScript enabled to view it.

 

To test ssmtp. Enter this command

ssmtp -v This email address is being protected from spambots. You need JavaScript enabled to view it.

Type your message.
Send Ctrl-d when finished