On Fri, Apr 18, 2014 at 05:18:55PM +0200, Joachim Coqblin wrote:

> needs a Postfix specialist.

No, just someone with a respectable score on regex golf:

    http://regex.alf.nu/

> /From:(*tomorrowltd.*.)/i  REJECT "Die spammer!!"

You forgot to "anchor" the expression:

        /^From:.../

You threw in unnecessary paretheses, the pattern:

        /(foo)/  

is better written more simply as:

        /foo/

when you have no backreferences and are not using matched sub-patterns
in the replacement string.

Unlike shell file globbing, "*" alone does not match an arbitrary string,
that's done with ".*".  A correct implementation of this is:

    header_checks:
        if /^From:/
        # From: rules below
        /[@.]tomorrowltd\./     REJECT
        ...
        # All remaining rules are not "From:" rules, we're done.
        /^/                     DUNNO
        endif

        if /^Subject:/
        # Subject: rules below
        ...
        # All remaining rules are not "Subject:" rules, we're done.
        /^/                     DUNNO
        endif

        if /^Sender:/
        # Sender: rules below
        ...
        # All remaining rules are not "Sender:" rules, we're done.
        /^/                     DUNNO
        endif

        ...

-- 
        Viktor.

Reply via email to