Please take special note of my sigline before you take the time to
deliberatley re-add my email address to the recipients list.
Thanks for the reply. But I am still not getting the procmail syntax :( (i
read the man page too )
Before you go about using a tool to manipulate the mail of all the users of
your system, it'd be a good idea to gain more familiarity with it. A few
missteps, and you could be trashing a lot of email.
As I asked in my first question, How do I run external script and return
value from it?
That has been answered by another poster. In the case of the rest of your
original post, while you did ask how to invoke an external program, as
posed. you asked how to compare against some predefined value, and as such,
there didn't seem to be any need to actually invoke an external program to
achieve the desired result.
Note that you _could_ invoke an external program to obtain settings for a
user. As per the procmailrc manpage, $LOGNAME contains the username (NOT
email address) of the user for which the mail is being processed. You
could use that as an argument to a simple grep or a db tool to extract a
record of settings for that user:
FILTER_OPTIONS=|`grep "^$LOGNAME " central_userlist`
:0
* $FILTER_OPTIONS ?? [ ]ASSASSIN\>
{
LOG="user has opted to use Spam Assassin$NL"
# do something
}
:0
* $FILTER_OPTIONS ?? [ ]THRESHOLD=\/[-.0-9]*\>
{
THRESHOLD=$MATCH
LOG="user's threshold is defined as $THRESHOLD$NL"
# do something with that...
}
central_userlist would be a passwd-style one line per username structure:
username1 ASSASSIN FUBAR
username2 FUBAR
username3 ASSASSIN THRESHOLD=8.2
What I am trying to do is, let user define their own spam thresold value.
Could easily allow them to set it as a value within a file in their own
home directory and include that (presuming that you're executing DROPPRIVS
beforehand, lest you include code which executes with privledge). OR, more
appropriatley, and as already mentioned, use the facilities within SA that
are there for per-user settings, completely negating the need to tweak
around with procmail for the purpose.
You have used value 3 which is hardcoded in the procmail script.
Seems to match the definition of "predefined value" (as versus a dynamic
value).
However, it could be incorporated via an include file, or read from a db,
etc as already mentioned.
I want to get it from a script and the script will in turn query a
database or some flat file.
It might really help if you decide how you're going to do that part of it
and then ask how to take that value and utilize it within procmail (say, to
define that threshold value).
For now I tried this:
My Spam-assassin heard looks like
X-Spam-Debug-Wlink: -4.9
:0:
* X-Spam-Debug-Wlink:.\/*
That should be anchored to the beginning of the line, and the * is
ill-specified. A more appropriate syntax would be something like (untested):
* ^X-Spam-Debug-Wlink:[ ]*\/[-.0-9]*
* -5^0
* $ $MATCH^0:
spam
This should catch anything greater than -5 (including -4.9) right?
(FTR, that -5 bit looks hard-coded...)
The significance of sign should not be overlooked. The -5^0 means to
simply subtract 5 from the current score. Then, you're taking the match
(which may incorporate other text and ADDING it. If it's a NEGATIVE
already, then that amounts to subtraction, which will net you a more
significant negative value. Scoring (see 'man procmailsc') still requires
the non-scored conditions to evaluate as true AND the resulting score must
be positive for the scoring to evaluate as true.
[snip - more trimmage would be appreciated]
---
Sean B. Straw / Professional Software Engineering
Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
Please DO NOT carbon me on list replies. I'll get my copy from the list.
____________________________________________________________
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