This is an old revision of the document!
See also Postfix Authenticated Smarthost (Does the same thing without requiring the EPEL repo.)
http://www.linux.com/archive/feature/132006
http://www.squad17.org/node/39
SSMTP is a simple replacement for a full MTA such as Sendmail or Postfix.
See also Using the EPEL Repository
Install ssmtp:
yum install ssmtp --enablerepo=epel
On one older system, mdadm
depended on sendmail
, I had to do this first:
rpm -e --nodeps sendmail
For SSL connections on SMTPS port 465:
vim /etc/ssmtp/ssmtp.conf root=adminuser@yourdomain.com mailhub=mail.yourdomain.com:465 RewriteDomain=yourdomain.com #hostname=_HOSTNAME_ FromLineOverride=YES UseTLS=YES AuthUser=smtpuser AuthPass=smtppass #Debug=YES
If you want to use TLS connections on Submission port 587, you will need to add/change:
mailhub=mail.yourdomain.com:587 UseSTARTTLS=YES TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt # Optional?
If you don't specify a
hostname
, SSMTP will query the local machine. Since we are authenticating, the hostname doesn't matter too much.
If desired, enable (un-comment) the debug line, then look in
/var/log/maillog
.
If desired, install the mail
command:
yum install mailx update-alternatives --config mta
echo test | mail -s "testing ssmtp" tester@yourdomain.com
Or with no mail
command and no subject line:
echo test | ssmtp -v tester@yourdomain.com
or
echo test | sendmail -v tester@yourdomain.com tail -f /var/log/mailog
cat << EOF >> /tmp/test.eml From: MyPBX <smtp@MyPBX> To: Test <tester@yourdomain.com> Subject: For test only! EOF ssmtp -t < /tmp/test.eml
On Centos:
alternatives --config mta