Skip to main content

Proxmox Postfix Gmail

Google account setup

Google deprecated less secure apps. Now you need to generate app passwords

Activate 2FA on the Gmail account

Generate an App password for emails

Proxmox server setup

Install libsasl2-modules on the Proxmox server.

Create fileĀ  /etc/postfix/sasl_passwd and add:

[smtp.gmail.com]:587 <[email protected]>:<app_password>

Then run

chmod 600 /etc/postfix/sasl_passwd && postmap /etc/postfix/sasl_passwd

Edit file /etc/postfix/main.cf

relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options =
smtp_sasl_password_maps = hash:/usr/local/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/mail/certs/cacert.pem

Restart Postfix:

systemctl restart postfix.service

Test if it works:

echo "My message" | mail -s subject [email protected]

Logs are available atĀ /var/log/mail.log if it's not working