Skip to content
Geek is the Way!
Menu
  • Forums
  • Sobre o blog
  • Contato
  • English
    • Português
Menu

Configuring E-mail alerts on your Proxmox Virtual Environment

Posted on March 7, 2021December 30, 2024 by Thiago Crepaldi

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-modules

Optional: 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_passwd

With your favorite editor, hopefully vim or nano, edit Postfix configuration file.

# vim /etc/postfix/main.cf

Append 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 = 3600s

Before 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 system

For 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-modules

Optional: 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_passwd

With your favorite editor, hopefully vim or nano, edit Postfix configuration file.

# vim /etc/postfix/main.cf

Append 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 = 3600s

Before 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 system

For 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.

Share this:

  • Tweet

Related

Leave a ReplyCancel reply

LIKED? SUPPORT IT :)

Buy Me a Coffee


Search


Categories

  • Cooking (1)
  • Homelab (79)
    • APC UPS (6)
    • pfSense (40)
    • Proxmox (20)
    • Shopping (1)
    • Supermicro (2)
    • Synology NAS (8)
    • Ubiquiti (6)
    • UDM-Pro (4)
  • Random (3)
  • Wordpress (1)

Tags

Agentless monitoring (3) AP9631 (3) Apache2 (3) APC UPS (6) Bind9 (3) certificates (5) crontab (2) DDNS (5) debian (3) DNS (7) DSM (6) DuckDNS (2) Dynamic DNS (4) en_US (2) Firewall (9) gmail (3) LDAP (2) Let's Encrypt Certificates (7) monitoring (18) networking (21) PBS (3) pfsense (43) port forwarding (3) proxmox (17) proxmox backup server (3) proxmox virtual environment (16) pve (5) rev202207eng (76) security (28) SNMP (4) SNMPv1 (3) ssh (4) SSL (6) subnet (2) Synology (7) udm-pro (5) unifi (6) unifi controller (3) unifi switch (2) UPS (5) VLAN (4) vpn (9) wifi (4) Zabbix (18) Zabbix Agent2 (11)

See also

Privacy policy

Sitemap

©2025 Geek is the Way! | Design by Superb