software:proxmox:pmg_sender_dependent_relayhost

PMG - Sender dependent relayhost

In Proxmox, not all Postfix configuration is exposed, and editing postfix configuration files is no good, as any changes through web interface overrides the complete file.

The correct way to do this is through templates

cp /etc/pmg/templates/main.cf.in /etc/pmg/templates/
vim /etc/pmg/templates/main.cf.in
 
#append these lines to the end
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_mechanism_filter = plain, login
smtp_tls_security_level = may
smtp_tls_note_starttls_offer = yes
 
 
vim /etc/postfix/sender_relay
@example.com    [mail.example.com]:26
@example1.com   [1.2.3.4]:26
 
postmap /etc/postfix/sender_relay
 
 
vim /etc/postfix/sasl_passwd
[mail.example.com]:26    smarthost@example.com:secret_password
[1.2.3.4]:26             username:secret_password
 
postmap /etc/postfix/sasl_passwd
 
 
systemctl restart postfix
pmg-smtp-filter restart
pmgconfig sync --restart 1
 
tail -f /var/log/mail.log
  • software/proxmox/pmg_sender_dependent_relayhost.txt
  • Last modified: 2025/04/03 23:05
  • by tplecko