On 07/22/2013 05:30 PM, Wietse Venema wrote:
Florin Andrei:

The goal is to send most emails to local, send most mydomain.com
recipients to a relay nearby, and let foobardomain.com senders go out on
the Internet freely.

Presumably, if foobardomain.com senders send mail to local or
mydomain.com recipients, then that mail should also not go to the
Internet.

No, it's the other way round. foobardomain.com will typically send emails to addresses unrelated to mydomain.com or local accounts.

Here's the complete logic (I should have spelled it out from the beginning):

1. If sender is @foobardomain.com then let them do anything, send email anywhere they want. For these senders, this should be a bare-bones relay, no special rules, with the relay behavior only controlled by $mynetworks.

2. If the above is not matched, then: For a few @mydomain.com recipients, emails should be sent to local. All other @mydomain.com recipients should be stuffed into a specific relay.

3. Everything else not caught by the above is sent to local.

I believe #2 and #3 are taken care of by the following transport:

j...@mydomain.com       local:
j...@mydomain.com       local:
mydomain.com            :[relay.mydomain.com]
*                       local:

The part I'm having trouble with is #1.

Does your advice below still stand?

In that case, set sender_dependent_default_transport_maps so that
all senders resolve to the error transport except for a few.

/etc/postfix/main.cf:
     # Override default_transport NOT transport_maps.
     sender_dependent_default_transport_maps = pcre:/etc/postfix/sender_pcre

/etc/postfix/sender_pcre:
     if !/@foobardomain\.com$/
     /./ error:5.7.1 Sorry, you can't send mail to that destination
     endif

Then specify explicit transport:nexthop entries for local and
mydomain.com mail using main.cf:transport_maps.

This is all from memory.

        Wietse



--
Florin Andrei
http://florin.myip.org/

Reply via email to