I have set up a default smart host/relay for all external mail as follows:
relayhost = [22.214.171.124]:587
However, I want recipients with specific MX (n.b. *google.com) to be sent directly, without using the relayhost, so I did:
smtpd_recipient_restrictions = check_recipient_mx_access pcre:/etc/postfix/mxtransport ...
/google\.com$/ FILTER smtp: /googlemail\.com$/i FILTER smtp:
This is working as it should for a single recipient. If mail is addressed to multiple recipients (using To:/Cc:/Bcc:) and some of the specified recipients satisfy the mxtransport rule and some do not, Postfix sends mail to ALL recipients ignoring the default relayhost definition. For example, if I send email to email@example.com, Postfix correctly sets the filter and sends mail directly without using smarthost. However, if I send mail to multiple recipients containing firstname.lastname@example.org, email@example.com, it would still assume I want to skip smarthost for ALL recipients.
Is it possible to have different transport per recipient when multiple recipients are specified?