SSMTP

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.

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

 

edit /etc/ssmtp/ssmtp.conf # # root=username+root.voip@gmail.com mailhub=smtp.gmail.com:587 hostname=voip.example.com FromLineOverride=YES AuthUser=username@gmail.com AuthPass=yourpassword UseTLS=YES UseSTARTTLS=YES AuthMethod=LOGIN
 * 1) Config file for sSMTP sendmail
 * 1) The person who gets all mail for userids < 1000
 * 2) Make this empty to disable rewriting.
 * 3) root=postmaster
 * 1) The place where the mail goes. The actual machine name is required no
 * 2) MX records are consulted. Commonly mailhosts are named mail.domain.com
 * 3) mailhub=mail
 * 1) Where will the mail seem to come from?
 * 2) rewriteDomain=
 * 1) The full hostname
 * 1) Are users allowed to set their own From: address?
 * 2) YES - Allow the user to specify their own From: address
 * 3) NO - Use the system generated From: address