Multiple recipients and separate transport (via FILTER) per recipient

46 views
Skip to first unread message

Locojohn

unread,
Nov 15, 2020, 10:56:11 AM11/15/20
to
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 joe...@gmail.com, Postfix correctly sets the filter and sends mail directly without using smarthost. However, if I send mail to multiple recipients: joe...@outlook.com, joe...@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

unread,
Nov 16, 2020, 7:59:38 AM11/16/20
to
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.
Reply all
Reply to author
Forward
0 new messages