/etc/ssmtp/ssmtp.conf
# The user that gets all the mails (UID < 1000, usually the admin)
root=username@gmail.com
# The mail server (where the mail is sent to), both port 465 or 587 should be acceptable
# See also https://support.google.com/mail/answer/78799
mailhub=smtp.gmail.com:465
# The address where the mail appears to come from for user authentication.
rewriteDomain=gmail.com
# The full hostname. Must be correctly formed, fully qualified domain name or GMail will reject connection.
hostname=yourlocalhost.yourlocaldomain.tld
# Use implicit TLS (port 465). When using port 587, change UseSTARTTLS=Yes
#TLS_CA_FILE=/etc/ssl/certs/ca-certificates.crt
UseTLS=Yes
UseSTARTTLS=No
# Username/Password
AuthUser=username
AuthPass=password
AuthMethod=LOGIN
# Email 'From header's can override the default domain?
FromLineOverride=yes
Each Unix user can/probably should be overridden to send mail as the SMTP user setup in the sSMTP config above.
/etc/ssmtp/revaliases
root:username@gmail.com:smtp.gmail.com:465
mainuser:username@gmail.com:smtp.gmail.com:465
Send mail from the CLI
echo -e 'Subject: test\n\nTesting ssmtp' | sendmail -v ross@gmail.com