<< Back to man.ChinaUnix.net

3. SSMTP

I choose to replace Sendmail with SSMTP.

monitor# cd /usr/ports/mail/ssmtp
monitor# make install replace clean
monitor# cd /usr/local/etc/ssmtp
monitor# ls
revaliases.sample       ssmtp.conf.sample
monitor# cp revaliases.sample revaliases
monitor# cp ssmtp.conf.sample ssmtp.conf
monitor# ls
revaliases              revaliases.sample       ssmtp.conf              ssmtp.conf.sample

Now edit the SSMTP configuration file.

monitor# ee /usr/local/etc/ssmtp/ssmtp.conf

Below is my sample configuration, the config file is commented if you need another example.

mailhub=192.168.0.2 (this will be a mail server you can send mail through, can be IP or FQDN)
rewriteDomain=nagiosbook.org
hostname=monitor

Make sure you disable Sendmail by editing /etc//rc.conf and adding the following directives. (This is for FeebSD version 5 or later)

# ee /etc/rc.conf
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"

Test to make sure you can send mail by:

mail -s "Test" root
<ctrl-d>

You should now be able to send email from your Nagios server.