Skip to main content

Setup Email Notifications

Configuring User E-mail Address

  1. In a web browser, navigate to the Proxmox web UI and login
  2. Select Datacenter > Permissions > Users from the left navigation menus
  3. Double click the user to configure
  4. Complete the E-mail field on the Edit User form > Click OK

Simple Configuration via Web UI

By default, Proxmox will try to use the domain portion of the "Email from address" as the e-mail relay server.

  1. Select Datacenter > Options from the left navigation menus

  2. Double click the Email from address field

  3. Enter the e-mail address that Proxmox will send outgoing e-mails from > Click OK

  4. Expand Datacenter > Select the node name > Click Shell in the left navigation menus

  5. Run the following commands in the terminal

     

    # Send a basic test email
    echo "Test email from Proxmox: $(hostname)" | /usr/bin/proxmox-mail-forward
    
    # Output the mail log
    cat /var/log/mail.log
  6. Notice the relay is the domain (i12bretro.local) from the Email from address setting

Advanced Configuration via CLI

To make more advanced configuration changes, like using a gmail account, you need to edit the postfix settings via command line

  1. Back in the Proxmox web shell, run the following commands in the terminal

    Install libsasl

    apt install libsasl2-modules -y

    Edit the postfix config

    nano /etc/postfix/main.cf
  2. Press CTRL+W and search for mydestination

  3. Comment out mydestination by adding a # to the beginning of the line

  4. Press CTRL+W and search for relayhost

  5. Comment out relayhost by adding a # to the beginning of the line

  6. Update or add the following configuration

     

    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

    For O365 use the following

    relayhost = smtp.gmail.com:587
    smtp_use_tls = yes
    smtpd_tls_security_level = may
    smtp_tls_security_level = encrypt
    smtp_sasl_security_options = noanonymous
    smtp_use_tls = yes
    smtp_tls_wrappermode = yes
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    smtp_tls_CAfile = /etc/ssl/certs/Entrust_Root_Certification_Authority.pem
  7. Press CTRL+O, Enter, CTRL+X to write the changes

  8. Continue with the following commands in the terminal

    Create /etc/postfix/sasl_passwd

    nano /etc/postfix/sasl_passwd
  9. Add a line to configure gmail authentication

     

    smtp.gmail.com:587 <%youraccount%>@gmail.com:<%yourpassword%>
  10. Press CTRL+O, Enter, CTRL+X to write the changes

  11. Continue with the following commands in the termina

     

    # Update postfix lookup tables
    postmap hash:/etc/postfix/sasl_passwd
    
    # Limit access to sasl_passwd to only root
    chmod 600 /etc/postfix/sasl_passwd
    
    # Restart postfix service
    systemctl restart postfix
    Test from postfix directly
    echo "Test email from Proxmox: $(hostname)" | mail -s "Proxmox Testing" <%youraccount%>@gmail.com
    
    # Send a test from proxmox
    echo "Test email from Proxmox: $(hostname)" | /usr/bin/proxmox-mail-forward