procmail
[Top] [All Lists]

Re: multiple action on delivered-main

2003-01-29 14:52:04
Manojav Sridhar <manojav(_at_)manojav(_dot_)com> wrote:

:0fW
* ?(echo "$FROM" | $FGREP -i -f $HOME/.procmail/spam)
| /usr/bin/formail -I "Status: R"

:0:
* ?(echo "$FROM" | $FGREP -i -f $HOME/.procmail/spam)
spam

this works fine.

basically i want procmail to perform this funtion check if the from
address is in the file "spam" if it is, deliver it to the spam folder
and mark it as read.

Use the `a' flag to chain conditions across recipes when the exit code
"succeeds" in the first recipe.

Your second recipe in the set could just read:

        :0 a:
        spam


By the way, fgrep will become confused if $FROM starts with a hyphen.
You would do well to add `-e' to your fgrep extension.  Moreover, you
don't need the echo, and hence also don't need the shell parentheses or
pipe.  What version of fgrep are you using?  Modern fgrep implies the
`-f' already -- unless I've misunderstood something about your syntax.
You might also think of adding `-x', `q', and `s' to the mix.  Check the
man pages.

        * ? $FGREP -qsix -e "$FROM" some/file


Finally, there usually is no need to bother assigning an executable to
a variable.  Isn't fgrep in procmail's combined-in path?  If it isn't,
you should ask yourself why.

-- 
dman


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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