But if in the message Subject is before From, then the Subject will be tested before the From header is tested.
The rules process the message, starting from the first header IN THE MESSAGE, and that gets checked against the rules. THEN the second header in the message is tested, then the third. The order of the headers in the message determines the order the rules are checked. It does NOT happen that the first rule is tested, sees that it wants a >From header, and the message is searched for a matching From header. To do that, you need them to be totally separate passes, not rules within a single pass. Your 'first' rule isn't 'skipped', it is that the Subject rule gets matched first because that is the first header that is being found (from that sender) that matches a rule, so you never got to the From header line to test it. On 6/8/19 11:06 PM, Webmaster wrote: > Thank you so much for your input, Richard. Appreciate. > > Hmm.. Right, this is the way I understand it too. However, my first > rule that matches the header (from field) is skipped for some reason. > Then the second rule that matches the header (subject field) is > applied, not skipped. Now these two rules work fine if they go one by > one, but they do not work if they go together in combination (tested). > I am lost.. > > It looks like REJECT triggers this query match and stops there > accordingly. However, REPLACE doesn't trigger the query match and the > search goes on until it "meets" REJECT. In my opinion that's exactly > what's going on here in my case.. . Is that not right? Am I wrong? > > > -----Original Message----- > From: Richard Damon <rich...@damon-family.org> > To: postfix-users@postfix.org > Sent: Sun, 09 Jun 2019 3:57 > Subject: Re: Regexp Postfix query doesn't stop at the first matching rule > > I think the sequence (and Wietse can correct me if I am wrong) is that > the first header in the message is taken, and searched to see if any > rule matches, if so, that rule is used. If that header doesn't match any > rule, the next header is gotten and checked against the rules, and so > on. The first header in the message that matches a rule is the one that > dominates. > > The order the rules are written doesn't matter that much (unless two of > them might match the same header). It is the order the headers are in > the message (which you really can't control). -- Richard Damon