procmail
[Top] [All Lists]

Re: Argh! Why is procmail doing this?

1998-12-03 14:02:15
UG <ug(_at_)unixgeek(_dot_)com> writes:

I am trying to filter out the numerous (and annoying) "I'm going on
vacation, please contact..." type emails which pervade my office with
the following recipie:

:0:vaca.lock
* ^Subject: (OOt?O)|(00t?0)|(out of (the )?(office|town))|(on (planned )?(vaca
tion|leave))
* ! ^TO .*mcampbell@(s1|s-1).com
* ! ^Subject: *(Re|\[Re\]):?
* ! ^X-Loop: ug(_at_)unixgeek(_dot_)com
vacation.spool


But it's catching things it shouldn't.  Here's the log entry on one such
"offense".  (With "verbose" logging on.)

You have the precedence of concatenation and '|' mixed up:  You need to
put parens around the entire '|' expression, not its components.  Also,
you shouldn't put ".*" after "^TO" -- the ^TO token has the necessary
wildcarding built in.  Finally, the 'Re' Subject: condition is not
entirely correct.  For example, it'll match a subject of "Regardless of
planning", because the trailing colon is completely optional.  Perhaps
a better plan is to force a non-alphanumeric character after the "Re"
when it's not surrounded with brackets.  I've made those change below:

        :0:vaca.lock
        * ^Subject: (OOt?O|00t?0|out of (the )?(office|town)|\
                        on (planned )?(vacation|leave))
        * ! ^TOmcampbell@(s1|s-1).com
        * ! ^Subject: *(Re\>|\[Re\])
        * ! ^X-Loop: ug(_at_)unixgeek(_dot_)com
        vacation.spool


Philip Guenther

<Prev in Thread] Current Thread [Next in Thread>