📣 Setting Up Email Alerts on Proxmox (Using Gmail & Postfix)
This guide shows how to configure Proxmox to send system notifications via email using Gmail’s SMTP servers. It's useful for receiving alerts about VM states, backups, or hardware failures.
1. Install Required Packages
First, install mailutils
(for sending mail) and libsasl2-modules
(to support SMTP authentication):
2. Generate an App Password from Google
If using Gmail, you must create an App Password (standard Google password won't work for SMTP). Go to:
👉 https://myaccount.google.com/apppasswords
Select “Mail” as the app, and generate a new password. Copy this for later.
3. Configure SMTP Credentials for Postfix
Create a file with your Gmail SMTP credentials:
echo "smtp.gmail.com [email protected]:YourAppPassword" > /etc/postfix/sasl_passwd
Replace
[email protected]
andYourAppPassword
accordingly.
4. Set Secure Permissions
Restrict file permissions to protect sensitive credentials:
5. Generate the Hashed Credentials File
Postfix uses a hashed version of the credentials file:
Confirm the .db
file was created:
6. Edit Postfix Configuration
Open the Postfix config file:
And append or update the following Gmail-specific settings:
relayhost = smtp.gmail.com:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options =
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/Entrust_Root_Certification_Authority.pem
smtp_tls_session_cache_database = btree:/var/lib/postfix/smtp_tls_session_cache
smtp_tls_session_cache_timeout = 3600s
These settings configure Postfix to authenticate via TLS with Gmail’s SMTP server.
7. Reload Postfix
Apply the changes:
8. Send a Test Email
You can verify the setup with a test message:
echo "This is a test message sent from postfix on my Proxmox Server" | mail -s "Test Email from Proxmox" [email protected]
9. Customize the "From" Header
By default, Gmail may replace the sender with your Gmail address. To make the "From" field show a custom name like pve1-alert
, do the following:
Install the PCRE module:
Create a header rewrite rule:
Add:
/^From:.*/ REPLACE From: pve1-alert <[email protected]>
Then hash the file:
Confirm it worked:
10. Enable the Header Rewrite Rule
Edit your Postfix config again:
At the bottom, add:
Reload the Postfix service:
Acknowledgment This guide is based on the original post by Techno Tim: Proxmox Alerts Guide. I’ve expanded on the steps with added explanations and commentary.