On 1/10/2014 7:13 AM, Wijatmoko U. Prayitno wrote:
> On Fri, 10 Jan 2014 06:34:24 -0600
> Noel Jones <[email protected]> wrote:
> 
>> On 1/10/2014 3:48 AM, Ansgar Wiechers wrote:
>>> On 2014-01-10 Wijatmoko U. Prayitno wrote:
>>>> On Fri, 10 Jan 2014 09:15:38 +0100 Kenneth Qvistgaard Dalbjerg wrote:
>>>>> I have this in my header_checks files:
>>>>>
>>>>> /^From:.*\@ullabulla\.dk/      REDIRECT [email protected]
>>>>>
>>>>> Thats working fine, but i will like, if mail sent to *@customer.dk is
>>>>> not forwarded to my mail address, but instead is sent to the original
>>>>> recipient.
>>>>>
>>>>> Is that posible to do?
>>>>
>>>> Yes it is possible, just use "!" to exclude it.. take closer look
>>>> here: http://www.postfix.org/header_checks.5.html
>>>
>>> I don't think this is possible. header_checks evaluates one header at a
>>> time, so you can't conditionally check To: and From: header in the same
>>> rule.
>>
>> Correct, header_checks cannot make decisions on multiple headers.
>>
>> However, you can achieve the goal by using smtpd restriction
>> classes. Docs and examples here:
>> http://www.postfix.org/RESTRICTION_CLASS_README.html
>>
> $ cat test.pcre
> if !/^To:.*\@customer\.dk$/
> /^From:.*\@ullabulla\.dk$/ REDIRECT [email protected]
> endif
> 

As you've already been told, header_checks cannot make decisions
based on multiple headers. The message is examined one header at a
time, state is not saved between different headers.

You can use a restriction class as suggested above. Alternately, you
can use a policy service such as postfwd.

And really, delivery decisions should always be made on the
envelope, not headers.


  -- Noel Jones

Reply via email to