This tutorial will guide you through installing SSMTP on CentOS 5.6
SSMTP is an extremely simple MTA to get mail off the system to a mail hub. It contains no suid-binaries or other dangerous things – no mail spool to poke around in, and no daemons running in the background. Mail is simply forwarded to the configured mailhost. Extremely easy configuration. WARNING: the above is all it does; it does not receive mail, expand aliases or manage a queue.
Firstly lets install the EPEL repository as SSMTP is not native to CentOS 5.6 base installations.
Install the EPEL i386 YUM Repository
# rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
Remove Sendmail as the binaries can conflict.
# yum remove sendmail
Now install SSMTP
# yum install ssmtp
SSMTP is now installed and all that is let is to configure it.
For a really basic installation uncomment and replace with your mailserver and domain details mailhub and RewriteDomain
# cp /etc/ssmtp/ssmtp.conf /etc/ssmtp/ssmtp.conf.orig
# vi /etc/ssmtp/ssmtp.conf
# /etc/ssmtp.conf -- a config file for sSMTP sendmail.
# See the ssmtp.conf(5) man page for a more verbose explanation of the
# available options.
# The person who gets all mail for userids < 500
# Make this empty to disable rewriting.
# The place where the mail goes. The actual machine name is required
# no MX records are consulted. Commonly mailhosts are named mail.domain.com
# The example will fit if you are in domain.com and your mailhub is so named.
# Example for SMTP port number 2525
# Example for SMTP port number 25 (Standard/RFC)
# Example for SSL encrypted connection
# Where will the mail seem to come from?
# The full hostname
# Set this to never rewrite the "From:" line (unless not given) and to
# use that address in the "from line" of the envelope.
# Use SSL/TLS to send secure messages to server.
# Use SSL/TLS certificate to authenticate against smtp host.
# Use this RSA certificate.
# Get enhanced (*really* enhanced) debugging information in the logs
# If you want to have debugging of the config file parsing, move this option
# to the top of the config file and uncomment