SSMTP

From FusionPBX
Jump to: navigation, search

ssmtp is a simple mail relay program. This will allow you to have system email sent to an email account of your choosing (Fail2Ban, cron, logwatch, etc) without having to run an smtp email server. It installs a binary package somewhat compatible with sendmail.

Install

Ubuntu/Debian

apt-get install ssmtp
apt-get install heirloom-mailx

heirloom-mailx provides the venerable CLI mail program, which is used by lots of programs to send mail. This is a lightweight version.

CentOS 5.4

CentOS doesn't include ssmtp

rpm -e sendmail-cf
rpm -e sendmail
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
yum -y install ssmtp

Configure

edit autoload_configs/switch.conf.xml

<param name="mailer-app" value="/usr/sbin/ssmtp"/>
<param name="mailer-app-args" value="-t"/>

edit /etc/ssmtp/ssmtp.conf

#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
#root=postmaster
root=username+root.voip@gmail.com
# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
#mailhub=mail
mailhub=smtp.gmail.com:587

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

# The full hostname
hostname=voip.example.com

# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES

AuthUser=username@gmail.com
AuthPass=yourpassword

UseTLS=YES
UseSTARTTLS=YES
AuthMethod=LOGIN