Discussion:
Multiple recipients and separate transport (via FILTER) per recipient
(too old to reply)
Locojohn
2020-11-15 15:56:09 UTC
Permalink
Hello,

I have set up a default smart host/relay host for all external mail as follows:

main.cf:

relayhost = [1.2.3.4]:587

However, I want mail for recipients with specific MX (n.b. *google.com) to be sent directly, bypassing the relayhost, so I did:

main.cf:

smtpd_recipient_restrictions =
check_recipient_mx_access pcre:/etc/postfix/mxtransport
...
mxtransport:

/google\.com$/ FILTER smtp:
/googlemail\.com$/i FILTER smtp:

This is working as expected for a single recipient. However, 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 directly, ignoring the default relayhost definition.

For example, if I send email to ***@gmail.com, Postfix correctly sets the filter and sends mail directly without using smarthost. However, if I send mail to multiple recipients: ***@outlook.com, ***@gmail.com, it would skip smarthost and send mail directly to both recipients, if FILTER rule had been applied to both.

Is it possible to have different transport per recipient when multiple recipients are specified?
Locojohn
2020-11-16 12:59:37 UTC
Permalink
I am hoping my question is not difficult to coprehend and that it describes well enough the issue I am having? Any ideas how to solve this issue would be greatly appreciated! Thanks.
Loading...