If it is supposed to be Source IP and destination address, do you really
need to do anything with the headers?

What I mean is, if you know the IP, make a restriction that if a mail is
being received from a specific IP, then push it onto another restriction
class, which then checks the recipient, and if it is the correct recipient,
allow it through, else reject it (or redirect it).

I realize this would add tons of restriction classes, but it would work for
what you are wanting to do, would it not?

Or do you mean the first hop, not the last hop prior to your server is what
you need to base it on?

On Fri, Dec 22, 2017 at 6:34 AM, Viktor Dukhovni <postfix-us...@dukhovni.org
> wrote:

>
>
> > On Dec 21, 2017, at 7:54 PM, li...@mypenguin.net.au wrote:
> >
> > I've a very unique need to configure Postfix to deliver email based on
> > source IP and destination email address.
> >
> > Example:
> > -----------------------------------
> > If:
> >    Received: by mx0.example2.com AND Delivered-To:
> > li...@mypenguin.net.au
> >
> >    Action: Deliver
> > else:
> >    Discard or Redirect (depending on user)
> > fi
> > -----------------------------------
> >
> > Can postfix header_checks do this?
>
> No.  Nor can any other MTA, because mail routing MUST be based
> the message envelope recipients not header recipients.
>
> > Looks like it'll only accept regex based on a line by line query?
>
> Correct, but headers would be the wrong criterion anyway.
>
> Policy services can return DISCARD verdicts for the message as
> a whole, based on the envelope and message original.  Milters
> or content filters should be able to delete specific recipients.
>
> --
>         Viktor.
>
>


-- 
 - Markus

Reply via email to