Postfix config: How to direct outgoing domains to different servers?


Scenario: Centos 7 OS with latest Virtualmin (full LAMP).
Virtualmin with 2 different domains hosted inside it.

Email-wise Domain A is full hosted inside and all incoming/outgoing emails are handled by the server. No other mail gateways involved. All works fine.

Domain B however uses an external 3rd party Email Gateway that acts as the MX of the domain (for incoming mail) and also as the outgoing SMTP for the domain. The purpose of the Email Gateway is the filtering of Spam/Antivirus of ALL email traffic.
Incoming traffic is configured and works fine.
How can I configure the Virtualmin/Postfix server that THIS (and only this) Domain B should NOT be delivered directly but sent to the Email Gateway?
Any ideas?

Hi !

I think you’re looking for sender_dependent_relayhost_maps and possibly smtp_sender_dependent_authentication, smtp_sasl_auth_enable, smtp_sasl_password_maps as well.

Best regards