2 minutes reading time (469 words)

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

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"

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

Postfix SASL Howto
http://www.postfix.org/SASL_README.html

Postfix TLS Support
http://www.postfix.org/TLS_README.html

Related Posts

 

Comments 2

Guest - CHP on Thursday, 07 September 2023 06:47

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.

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.
TechLabs on Monday, 11 September 2023 19:20

Thanks for the feedback on the guide, it is much appreciated!

Thanks for the feedback on the guide, it is much appreciated!
Already Registered? Login Here
Saturday, 23 September 2023
You can help support this website by buying me a coffee!
Buy Me A Coffee