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 $ cat customerdotdk To: [email protected] From: [email protected] Subject: test test $ postmap -q - pcre:/tmp/test.pcre <customerdotdk [output is empty] $ cat ullabulladotdk To: [email protected] From: [email protected] Subject: test test $ postmap -q - pcre:/tmp/test.pcre <ullabulladotdk From: [email protected] REDIRECT [email protected]
