sSMTP configuration

1. Requirements

  • Existing jail

2. References

3. Installation of sSMTP

SSH to your FreeBSD, enter the jail (jexec tcsh) and install sSMTP package using pkg manager.

pkg update && pkg upgrade
pkg install ssmtp
pkg autoremove
  • Note: The first time it will have to upgrade repositories, so don't worry if it downloads a lot of data.

4. Configuration of sSMTP

To replace sendmail with sSMTP change your configuration file `/etc/mail/mailer.conf` to:

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

Copy sample configuration file and update parameters below.

cp /usr/local/etc/ssmtp/ssmtp.conf.sample /usr/local/etc/ssmtp/ssmtp.conf

# set your mail server (where the e-mail will be sent)
mailhub=mail.example.com

# Where will the mail seem to come from?
rewriteDomain=example.com

# The full hostname
hostname=www.example.com

Optionally you can set hostname of the jail to the name which was set in the configuration file. For permanent change you have to edit the file `/etc/rc.conf`.

hostname www.example.com

5. Test sending e-mail

You can check setting by sending testing e-mail by the command:

echo test | mail -v -s "testing sSMTP setup" root@example.com

Comments