procmail
[Top] [All Lists]

Re: My brain hurts

1998-08-21 13:43:10
Paul Ashton <paul(_at_)argo(_dot_)demon(_dot_)co(_dot_)uk> writes:

guenther(_at_)gac(_dot_)edu said:
"Robertson, Hedley J. SPC" 
<robertsh(_at_)emh(_dot_)gordon(_dot_)army(_dot_)mil> writes: 
Just put a condition on what comes after the (mil|dod|gov) in the regexps:

     :0 c
     * ^From.*\.(mil|dod|gov)($|[^-a-z0-9_.])
     * BH ?? ^[      ]*subscribe signet.*\.(mil|dod|gov)($|[^-a-z0-9_.])
     | ./approve

That'll match only when the mil, dod, or gov is either at the end of
the line, or followed by something besides a letter, number, minus
sign, underbar or period.

What about:
From: "you can call me .mil" <paul(_at_)argo(_dot_)demon(_dot_)co(_dot_)uk> ?

If you're concerned about the perverse, then install the perl5 MailTools
extensions, and use the following recipe:

        :0 c
        * ^From.*\.(mil|dod|gov)($|[^-a-z0-9_.])
        * BH ?? ^[      ]*subscribe signet \/.*\.(mil|dod|gov)($|[^-a-z0-9_.].*)
        * ? perl -MMail::Address \
                 -e '@a = Mail::Address->parse($ENV{MATCH});' \
                 -e 'exit(! (@a == 1 && $a[0]->host =~ /\.(mil|gov|dod)$/))'
        | ./approve

You should probably test that before using it.


Philip Guenther

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