Configure Proxmox email notifications using Postfix SMTP relayhost
How to set up email alerts on Proxmox VE 6. Configure Postfix for SMTP relay and create a sasl_passwd file with username and password for SMTP authentication. Update Proxomox Datacenter email address and mail aliases for system emails and set up email alerts for Proxmox backup jobs.
Install SASL authentication modules
apt update
apt install libsasl2-modules
Configure Postfix server for SMTP relay
Edit the Postfix server configuration file
nano /etc/postfix/main.cf
relayhost = smtp-host.domain.com:587 smtp_use_tls = yes smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_tls_CApath = /etc/ssl/certs smtp_sasl_security_options = noanonymous, noplaintext smtp_sasl_tls_security_options = noanonymous
relayhost = smtp-host.domain.com:587 | SMTP relay server name and port |
smtp_use_tls = yes | Use Transport Layer Security (TLS) encryption |
smtp_sasl_auth_enable = yes | Enable SASL client-side authentication using username and password |
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd | Lookup table containing username and password for authentication |
smtp_tls_CApath = /etc/ssl/certs | Directory containing Certificate Authority certificates that Postfix will use to verify remote SMTP server's certificates |
smtp_sasl_security_options = noanonymous, noplaintext | Don't allow anonymous authentication or plaintext passwords for SASL authentication |
smtp_sasl_tls_security_options = noanonymous | Don't allow anonymous TLS authentication |
Create sasl_passwd file for SMTP authentication
nano /etc/postfix/sasl_passwd
smtp-host.domain.com email@domain.com:password
Create or update postfix lookup table
postmap /etc/postfix/sasl_passwd
You will need to run the postmap command whenever you change the sasl_passwd file
Postmap creates a hashed file call sasl_passwd.db which Postfix will use to read the login information
Change sasl_passwdand sasl_passwd.db permissions
Change owner to root and file permissions to 600
chown root:root /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
chmod 0600 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
Restart postfix
postfix reload
Update mail aliases file
nano /etc/aliases
Set the email address for root alias
rebuild the aliases database
newaliases
Send a test email
echo "this is a test email" | mail -s "test email" alerts@domain.com -r "alerts@domain.com"
echo "this is a test email" | mail -s "test email" alerts@domain.com -a "FROM:alerts@domain.com"
-r from-addr
Use the specified sender address as the from address in the message and envelope
from
Use the specified sender address in the "From:" field of the message header
Debian manpages - Mail
https://manpages.debian.org/bullseye/bsd-mailx/Mail.1.en.html
Check the mail log
tail /var/log/mail.info
Change Proxmox Datacenter email address
Datacenter - Options - Email from address - Edit
Set up email alerts for Proxmox backups
Datacenter - Backup - Select backup job - Edit
Send email to: email@domain.com
Email notification: Always
References:
Postfix Configuration Parameters
https://www.postfix.org/postconf.5.htmlPostfix SASL Howto
http://www.postfix.org/SASL_README.htmlPostfix TLS Support
by Author
http://www.postfix.org/TLS_README.html
Comments 2
to test the mail you may want to use
echo "this is a test email" | mail -s "test email" alerts@domain.com -r "alerts@domain.com"
I had the problem that I got the 5.7.1 error from smtp server with command mentioned in the blog post.
Great guide thank you.
Thanks for the feedback on the guide, it is much appreciated!