procmail
[Top] [All Lists]

Re: Mail body

1997-12-10 09:33:03
Marco Pirovano <marco(_dot_)pirovano(_at_)uni-bocconi(_dot_)it> writes:
I want to use procmail to do a simple filter:

if {in the body of the mail there is "students.uni-bocconi.it" purge the mail}
else { send the mail to a specific address}

Do I nedd to use same script in perl or other, or can I do it with 
procmail commmands ?

No need for perl.  Procmail can do basic if-else processing and it can
search in the body of the message using the 'B' flag:

        # If the phrase "students.uni-bocconi.it" occurs in the body, with
        # word boundaries on each end (so that "students.uni-bocconi.italy"
        # won't match), then /dev/null the message.  The leading parens
        # protect that first backslash from being processed differently.
        :0 B
        * ()\<students\.uni-bocconi\.it\>
        /dev/null

        # If the above recipe failed, then we're here.  Forward the message.
        # We could use the 'E' flag, but it's superfluous because if the
        # previous matchs, procmail will exit after delivering to /dev/null.
        :0
        ! some(_at_)specific(_dot_)address


Philip Guenther

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