I'd like to configure postfix to relay mail from certain sender addresses only. Postfix should relay mail to different relayhosts(/smarthosts) (Gmail, AOL, ...) dependent on the sender's address ("MAIL FROM:").
So far, my current configuration works as follows:
Users authenticate on postfix for mail relay in general. If they cannot authenticate, no relay is possible. Note that this authentication is different from the authentication for the relayhosts.
Dependent on the sender's address ("MAIL FROM:"), a certain relayhost is selected (
smtp_sasl_password_maps). This also works fine.
However, if the user can authenticate, and has a sender address not covered in
sender_dependent_relayhost_maps, postfix tries to directly relay the mail - which often does not work due to IP address restrictions (blacklists).
My question is now: how to reject mail that would have been relayed directly (without smarthost), i.e., where the sender's address is not listed in
sender_dependent_relayhost_maps? Any hints how to achieve this?