per domain outgoing relay host + credentials

Feb 28, 2024
10
1
1
Where do I input the credentials for the smarthost server?
And is it possible to use different smarthost for sender domain?
For example:
My mail server hosts 2 domains, and it uses proxmox as the smarthost
And proxmox would use smarthost.example2.com:465 for messages sent from @domain1.com, and smarthost.example2.com:465 for messages sent from @domain2.com

Is any of this possible?
I know that postfix can do this, but PMG overrides any custom configuration in those config files.
 
Last edited:
Worked it out.
Thanks

For anyone reading:


Bash:
# The important part
cp /etc/pmg/templates/main.cf.in /etc/pmg/templates/
vim /etc/pmg/templates/main.cf.in
# The important part
 
#append these lines to the end (depending on smarthost requirements
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

pmgconfig sync --restart 1
 
  • Like
Reactions: SteveITS