Ssmtp
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
- How To Use Gmail Account To Relay Email From a Shell Prompt - nixCraft - http://www.cyberciti.biz/tips/linux-use-gmail-as-a-smarthost.html
- How To Setup Email Alerts on Linux Using Gmail or SMTP - http://www.howtogeek.com/51819/how-to-setup-email-alerts-on-linux-using-gmail/
- Send SMTP email from Command Line Linux / SSMTP / GMAIL @ All Linux User's Blog - http://www.tejasbarot.com/2013/05/15/send-smtp-email-from-command-line-ssmtp-gmail/#axzz31z7eRhfd
keywords
linux smtp smarthost email mail