Postfix Setup

The typical scenario for a Rattail server is that it runs Linux and Postfix for the mail service. Here we describe that typical setup.

Basics

If you don’t already have Postfix installed, do that first:

sudo apt install postfix

It’s normally a good idea to declare your domain and hostname. Assuming your server is myserver.example.com then:

sudo postconf -e 'myhostname=myserver.example.com'
sudo postconf -e 'myorigin=example.com'
sudo systemctl restart postfix

Gmail Relay

Make sure Postfix knows to send all mail through Gmail relay:

sudo postconf -e 'relayhost=smtp-relay.gmail.com:25'
sudo systemctl restart postfix

This however assumes the Gmail relay is also configured to allow mail from your server. The most straightforward way to do this is via IP address authentication.

See Google Help for more info, but the gist is that you should choose “Only accept mail from the specified IP addresses” for the relay authentication within Google Admin settings. And then specify the public-facing IP address for your server.