SSMTP is no longer developed, but the two best options I found so far are SSMTP and MSMTP.
MSMTP is still developed and is good at forwarding e-mails TO:ROOT onto user@domain.com
BUT MSMTP doesn't support the "mail -s" command, which everybody knows.
SMSTP supports masking the FROM:ROOT = FROM:user@domain.com, but doesn't use /etc/aliases to forward on roots e-mail.
The choice is yours!
SSMTP
Ubuntu :
sudo apt-get update sudo apt-get install -y ssmtp mailutils sudo mv /etc/ssmtp/ssmtp.conf /etc/ssmtp/ssmtp.conf.orig sudo nano /etc/ssmtp/ssmtp.conf && sudo nano /etc/ssmtp/revaliases
CentOS :
yum install -y epel-release yum install -y nano mailx ssmtp sudo mv /etc/ssmtp/ssmtp.conf /etc/ssmtp/ssmtp.conf.orig sudo nano /etc/ssmtp/ssmtp.conf && sudo nano /etc/ssmtp/revaliases && echo 2 | alternatives --config mta
--SMTP CONF
# # Config file for sSMTP sendmail # sSMTP is no longer developed but still works great! # GMail Setup Defaults mailhub=smtp.gmail.com:587 rewriteDomain=gmail.com hostname=localhost FromLineOverride=YES UseTLS=Yes UseSTARTTLS=Yes # GMail Authenticaion # Username/Password (NO @Gmail) root=FreeSoftwareServers@gmail.com AuthUser=freesoftwareservers AuthPass=PassW0RD # Comcast Setup Defaults #Residential mailhub=smtp.comcast.net: #Business mailhub=smtp.hmc1.comcast.net:587 UseSTARTTLS=YES UseTLS=YES FromLineOverride=YES # Comcast Authentication #This will make e-mails arrive from root@hostname.business.com hostname=business.com #Business AuthUser=username@business.com #Residential AuthUser=Username # AuthPass=PassW0RD # Required for CentOS # http://unix.stackexchange.com/questions/109473/after-updating-ssmtp-to-version-2-61-i-cannot-send-mail-via-gmail TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt
--SMTP ALIAS
#sSMTP aliases # # Format: local_account:outgoing_address:mailhub # # Example: root:your_login@your.domain:mailhub.your.domain[:port] # where [:port] is an optional port number that defaults to 25. # NOTE THIS ONLY CHANGES TO FROM: FIELD, not an alias for TO: # ROOT E_MAILS WILL AUTO FORWARD TO ACCT USED IN CONFIG
root:freesoftwareservers@gmail.com root:/dev/null
--TEST
echo "Hello, World" | mail -s "My email check" freesoftwareservers@gmail.com