Christopher Juckins

SysAdmin Tips, Tricks and other Software Tools

User Tools

Site Tools


This is an old revision of the document!

GMail as a Relay on Linux Ubunutu 20.04 LTS and CENTOS8

Using Postfix for this solution.

dnf install postfix ca-certificates mutt
dnf install cyrus-sasl, cyrus-sasl-gssapi, cyrus-sasl-lib, cyrus-sasl-plain
systemctl start postfix
systemctl enable postfix

Follow instructions at

Or see the same at Sending Emails Using Postfix From Your Linux Server

  • Will this also break with less sure apps?
    • The "Less Secure Apps" is not available in Gmail if your account is configured for 2-factor authentication
    • Everything should work OK.

Perform the following steps as root:

cd /etc/postfix
mkdir /etc/postfix/sasl
cd /etc/postfix/sasl
vi sasl_passwd

Add this line:

[]:587 [email protected]:password
postmap /etc/postfix/sasl/sasl_passwd
chown root:root /etc/postfix/sasl/sasl_passwd /etc/postfix/sasl/sasl_passwd.db
chmod 0600 /etc/postfix/sasl/sasl_passwd /etc/postfix/sasl/sasl_passwd.db
vi /etc/postfix/

Comment out this line:

#smtp_tls_security_level = may

Now wdd to the end of the file:

# Local Edits
relayhost = []:587
# Enable SASL authentication
smtp_sasl_auth_enable = yes
# Disallow methods that allow anonymous authentication
smtp_sasl_security_options = noanonymous
# Location of sasl_passwd
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
# Enable STARTTLS encryption
smtp_tls_security_level = encrypt
# Location of CA certificates
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt

Restart postfix:

systemctl restart postfix
gmail_as_a_relay_on_linux_centos8.1648663297.txt.gz · Last modified: 2022/03/30 14:01 by juckins