procmail
[Top] [All Lists]

Re: [pro] How to apply multiple recipes to a single email?

2009-09-20 08:44:22
On Sun, 20 Sep 2009, Phill Edwards wrote:
What I want to do is apply multiple recipes to each incoming email.

Use the 'f' option on your recipe. This makes the recipe a 'filter'
that modifies the message. Then the action line pipes to 'formail'
to add the headers. Here's a functional (and useful) example:

# Spammer trick of placing TO address in from or subject.
# Add a header that can be detected by spamassassin....
:0fw
# First a test that always matches, and captures the 'To' recipient...
* ^To:.*([\"\'A-Za-z0-9\_\-]+ )*[^A-Za-z0-9\_\-]*\/[^ \<\(_at_)\>]+
{
    RECIPMATCH=$MATCH
# Then test for that recipient on the From Header.....
    :0fw
    * $^From:(_dot_)*$\RECIPMATCH\(_at_)insertyourdomainhere
    | formail -A"X-Spam-From: RECIPIENT"
# Then test for (to|for) recipient on the Subject Header ....
    :0fw
    * $^Subject: (To|For): $\VARMATCH(\(_at_)hwcn(_dot_)org)*[^A-Za-z0-9\_\-]*$
    | formail -A"X-Spam-Subject: TOFOR_RECIPIENT"
}

- Charles
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail

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