Skip to content

Instantly share code, notes, and snippets.

@PortNumber53
Last active April 11, 2022 04:31
Show Gist options
  • Save PortNumber53/13b2bb650b27cefc3245e7def0c3f1dd to your computer and use it in GitHub Desktop.
Save PortNumber53/13b2bb650b27cefc3245e7def0c3f1dd to your computer and use it in GitHub Desktop.
ArchlinuxArm postfix relay setup

Setting up Postfix as a mail relay to Gmail (Archlinux)

sudo pacman -S postfix mailutils mailx

Edit /etc/postfix/main.cf

relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
#smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_use_tls = yes

alias_maps = hash:/etc/postfix/aliases

Nothing to edit on /etc/postfix/master.cf maybe uncomment this:

  -o smtpd_tls_auth_only=yes

Edit sasl_passwd

[smtp.gmail.com]:587    [email protected]:APP_PASSWORD_GENERATED_UNDER_ACCOUNT_SECURIY_SETTINGS
sudo nano /etc/postfix/sasl_passwd
sudo chmod 400 /etc/postfix/sasl_passwd

Update aliases database

sudo newaliases

Update postfix lookup table

sudo postmap /etc/postfix/sasl_passwd

Start the service

sudo systemctl restart postfix.service

Test it!

echo "`date` Just testing my sendmail gmail relay" | mail -s "Sendmail gmail Relay" [email protected]

Enable it on

If everything works, enable the service:

sudo systemctl enable --now  postfix.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment