- 
SSH into proxmox node and become root user. Run the following commands to download extra software dependencies we'll need.
apt update apt install -y libsasl2-modules mailutils
 - 
Enable 2FA for the gmail account that will be used by going to security settings
 - 
Create app password for the account.
- Go to App Passwords
 - Select app: 
Mail - Select device: 
Other - Type in: 
Proxmoxor whatever you want here 
 - 
Write gmail credentials to file and hash it. Again, make sure you are root.
echo "smtp.gmail.com [email protected]:yourpassword" > /etc/postfix/sasl_passwd # chmod u=rw chmod 600 /etc/postfix/sasl_passwd # generate /etc/postfix/sasl_passwd.db postmap hash:/etc/postfix/sasl_passwd
 - 
Open the Postfix configuration file with editor of your choice.
nano /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 = 3600sIMPORTANT: Comment out the existing line containing just
relayhost=since we are using this key in our configuration we just pasted in. - 
Reload postfix
postfix reload
 - 
Test to make sure everything is hunky-dory.
echo "sample message" | mail -s "sample subject" [email protected]
 
- 
      
 - 
        
Save 2600box/a52079758a4ba5e6604c2f8f4ccb0163 to your computer and use it in GitHub Desktop.  
    Proxmox - Email Alerts Setup (gmail)
  
        
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            