Ssmtp

From Omnia
Jump to navigation Jump to search

smtp

ssmtp - "ssmtp is a send-only sendmail emulator for machines which normally pick their mail up from a centralized mailhub (via pop, imap, nfs mounts or other means)"

ssmtp - "extremely simple MTA to get mail off the system to a mail hub. A secure, effective and simple way of getting mail off a system to your 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."

Python Alternative

See ksmtp

Installation

Redhat based:

# in EPEL repo
yum install ssmtp

Debian based:

apt-get install ssmtp

Replace sendmail:

mv /usr/sbin/sendmail /usr/sbin/sendmail.original
ln -s /usr/sbin/ssmtp /usr/sbin/sendmail

Test:

echo "hello world" | mail -s "test" kenneth@demo.oeey.com

Configuration

Configuration file:

/etc/ssmtp/ssmtp.conf

Configuration man page:

man ssmtp.conf

Gmail

To relay mail though a gmail user:

AuthUser=[USERNAME]@gmail.com
AuthPass=[PASSWORD]
FromLineOverride=YES
mailhub=smtp.gmail.com:587
UseSTARTTLS=YES

To force all mail to a specific user:

Root=[EMAIL]
AuthUser=[USERNAME]@gmail.com
AuthPass=[PASSWORD]
FromLineOverride=YES
mailhub=smtp.gmail.com:587
UseSTARTTLS=YES

References

keywords

linux smtp smarthost email mail