procmail
[Top] [All Lists]

whitelist matching (was: How do I get the message body ???)

2002-08-11 16:01:52
Dave Kirkby wrote:

I'm still stuck with this, as neither of the two suggestions seem to
work
for me!

I'm not able to follow the syntax of this one:

:0:
* ^From:.*\/\<[a-z0-9=+_-]+(_at_)blow(_dot_)com

The \/ is a procmailism which will store everything _after_ it
matched by the regexp in a variable, $MATCH.  \< matches a word-boundary.

For example, if the From: header consisted of "me <foobar(_at_)blow(_dot_)com>",
then $MATCH would have the value of "foobar(_at_)blow(_dot_)com".

* MATCH ?? ^^\/[^(_at_)]+

Here we check $MATCH for a particular condition, one it won't
fail (if a valid from header exists in the mail), and which (by
side-effect) reduces $MATCH to just that part before the @ sign.
[^(_at_)] matches everything that isn't an @, so now, $MATCH would
have the value "foobar".[1]

* $ ? grep -w $MATCH mylist

This basically calls the command grep with $MATCH as its
argument.  Sooo, the first two parts of the recipe generate a
variable (a string) which gets passed to the third part (grep).
If grep returns positive (i.e. if $MATCH is in mylist), then the
mail gets delivered to (the folder) wasinlist.

but  I don't wish to store users at one site, but lots of sites, so they
will not all be in blow.com. The example is so complex I have no hope of
modifying it myself! Sorry.

You could just have:
:0:
* ^From:.*\/\<[a-z0-9=+_-]+@
* MATCH ?? ^^\/[^(_at_)]+
* $ ? grep -w $MATCH mylist
wasinlist

[...]

FROMHEADER=`formail -c -rtz -x To:`

:0 :
*  ? echo "${FROMHEADER}" | grep -F -isx -f $PMDIR/list.white
$MAILDIDR/ok

looks a lot simpler and easier to understand, but I can't get it to
work. I notice there is no pipe into formail, which I need on my system as
I'm invoking procmail via the .forward file.

The backticks are an alternate to a pipe, and indeed on some
systems (with older procmail versions) using the pipe syntax:
FOO=| bar
rather than
FOO=`bar`

causes a memory leak.

btw, the need to invoke procmail via a .forward doesn't
necessitate the need for a pipe to formail.

Is formail in the path procmail sees?  You could try writing the
value of $PATH from within your .procmailrc to a logfile to see
if formail does indeed get seen by procmail.

[...]

Hope that helps get you in the right direction.

[1] Note that on older procmail versions (I don't know what
    constitutes old, though I have heard it mentioned before), you
    can't reassign MATCH multiple times in the same recipe, and
    have to chain them together.

-- 
lawrence mitchell <s0198183+procmail(_at_)sms(_dot_)ed(_dot_)ac(_dot_)uk>

_______________________________________________
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>