Forwarding Proxmox email notifications

Posted on: 2025-01-11

I've been a happy user of Proxmox for several years now, but only recently deployed it in a large cluster environment. When you have a single server, keeping track of alerts isn't a big deal, but as you scale up, notifications become crucial. Whether it's to keep track of scheduled backups, or being notified of disks becoming full, you should have Proxmox notifications properly set up. Since I'm not hosting an email server locally on the cluster, which I suspect is the case for many, in this guide I'll show you how to forward Proxmox notifications to an external SMTP server.

For this use case, I use a service called smtp2go. This isn't sponsored, it's just a free service I use to forward email notifications to myself. You can use any email server you have access to.

Postfix configuration file

The first step is to SSH into each Proxmox node and edit the /etc/postfix/main.cf file. Update the following lines:

relayhost = [mail.smtp2go.com]:587
#mydestination = $myhostname, localhost.$mydomain, localhost
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

Note that some of these lines may already exist, including the mydestination one, so make sure you remove the existing values. This basically tells Postfix, the MUA used by Proxmox, to connect to an SMTP server using TLS.


SMTP server and credentials

Make sure you get the hostname of your SMTP server and login credentials. If you use smtp2go, you can go to the dashboard and create new credentials for your use case. Then, edit the /etc/postfix/sasl_passwd file with the following:

[mail.smtp2go.com]:587 MyUserId:MySecurePassword

Make sure you update the SMTP hostname, port number, your user ID and password.


Additional modules

Once done, you need to install an additional module to support TLS, then update Postfix and restart the service:

chmod 600 /etc/postfix/sasl_passwd
postmap /etc/postfix/sasl_passwd
apt-get install libsasl2-modules
systemctl restart postfix

That's it! To make sure it works, you can test your configuration with the following command:

echo "Testing mail from proxmox" | mail -s "Testing proxmox" youremail@example.com

Here make sure you enter your actual email address. If this works, then you should start getting Proxmox notifications by email.