Last Updated on December 30, 2024 by Thiago Crepaldi
In this post we are going to enable E-mail alerts for both our Proxmox Virtual Environment (PVE) and Proxmox Backup Server (PBS). The email server will be backed my GMail, which also works if you have Google Suite and a custom domain, such as yourdomain.com!
Although I have separate PBS and PVE configuration in two different sections in this post, the configuration content itself is identical. The difference is how to get to the shell terminal from their web UI.
How to setup Proxmox Virtual Environment email alert
Install dependencies
The first step is to install a library that will be used to support GMail authentication. Go to Server view >> Datacenter and select your server. Next, click at Shell button
# apt update
# apt install -y libsasl2-modulesOptional: Create app password for 2FA GMail accounts
If your GMail account has 2FA configured, go to App Passwords and generate a new password just for Proxmox
- Select app: Mail
- Select device: Other
- Select the app and device you want (…): Proxmox
Click on Generate and take note of this password
Setting GMail credentials
Now that all dependencies are installed and you have your password, let’s do the actually setting. Make adjustment to the snippet below to add your actual email and password separated by a colon.
# echo "smtp.gmail.com youremail@gmail.com:yourpassword" > /etc/postfix/sasl_passwd
# postmap hash:/etc/postfix/sasl_passwd
# chmod 600 /etc/postfix/sasl_passwdWith your favorite editor, hopefully vim or nano, edit Postfix configuration file.
# vim /etc/postfix/main.cfAppend the following to the end of the file
 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 = 3600sBefore saving the config file, also comment out the existing “relayhost =” line by updating it to “# relayhost =”. This is needed because the snippet you appended already sets this line to Google’s email and we can’t have duplicate settings.
At this point, all configuration is done. Just reload postfix and test it
# postfix reload
# echo "my msg" | mail -s "my subject" anotheremail@gmail.com
postfix/postfix-script: refreshing the Postfix mail systemFor the test email, you have to use a destination that is different than the email account you used to configure the server. If everything went well, you should get the email in your inbox in a couple seconds.
How to setup Proxmox Backup Server email alert
Install dependencies
The first step is to install a library that will be used to support GMail authentication. Go to Administration >> Shell button
# apt update
# apt install -y libsasl2-modulesOptional: Create app password for 2FA GMail accounts
If your GMail account has 2FA configured, go to App Passwords and generate a new password just for Proxmox
- Select app: Mail
- Select device: Other
- Select the app and device you want (…): Proxmox
Click on Generate and take note of this password
Setting GMail credentials
Now that all dependencies are installed and you have your password, let’s do the actually setting. Make adjustment to the snippet below to add your actual email and password separated by a colon.
# echo "smtp.gmail.com youremail@gmail.com:yourpassword" > /etc/postfix/sasl_passwd
# postmap hash:/etc/postfix/sasl_passwd
# chmod 600 /etc/postfix/sasl_passwdWith your favorite editor, hopefully vim or nano, edit Postfix configuration file.
# vim /etc/postfix/main.cfAppend the following to the end of the file
 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 = 3600sBefore saving the config file, also comment out the existing “relayhost =” line by updating it to “# relayhost =”. This is needed because the snippet you appended already sets this line to Google’s email and we can’t have duplicate settings.
At this point, all configuration is done. Just reload postfix and test it
# postfix reload
# echo "my msg" | mail -s "my subject" anotheremail@gmail.com
postfix/postfix-script: refreshing the Postfix mail systemFor the test email, you have to use a destination that is different than the email account you used to configure the server. If everything went well, you should get the email in your inbox in a couple seconds.

