LinuxServerSetup

SSMTP

Getting mail out of a new Linux box is relatively easy with SSMTP, which is still available in Ubuntu 20.04, thankfully. We need two files set up:

  • /etc/ssmtp/ssmtp.conf contains the actual server & authentication info.
  • /etc/ssmtp/revaliases supposedly allows aliasing the sender, but that doesn't seem to have worked yet on the new box. Needs confirmation/testing.

The ssmtp.conf file looks a bit like:

# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=greyduck@greyduck.net

# Gmail settings
UseTLS=YES
UseSTARTTLS=YES
#AuthMethod=LOGIN

# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.gmail.com:587

# Where will the mail seem to come from?
rewriteDomain=greyduck.net

# The full hostname
hostname=node3.greyduck.net

# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=NO

# Username and password for Google's Gmail servers
# # From addresses are settled by Mutt's rc file, so
# # with this setup one can still achieve multi-user SMTP
AuthUser=greyduck@gmail.com
AuthPass=APP_PASSWORD_GOES_HERE

And revaliases contains basically just this:

root:admin@frell.co:smtp.gmail.com:587

Your mileage may vary.