To confuse things further, my original answer to Jim never got the list
(only my response to Philip's answer). Here's what I was trying to say
earlier.
= = =
Jim wondered,
| I've tried to use a recipe like this to report the size of a mail:
[and we're off to a great start]
| #Toss huge things
| #
| :0
| * > 500000
| {
| LOG="Huge mail received: $=
| `formail -XFrom`
| "
Running formail there is unnecessary; better to extract into $MATCH.
| LOGABSTRACT=all
| :0
| $TRASH
| }
|
| but the size logged is always zero.
| The recipe above does indeed toss huge things, so I thought I'd
| be able to get the "score of the last recipe." What am I missing?
You're missing any scoring. Read the procmailsc(5) man page to learn about
that.
Here's one approach. I'm less than fond of it because it is rather
awkwardly laid out:
:0 # register the size as a score
* 1^1 > 1
{ } # space between the braces
SIZE = $= # save the score as the size
MATCH # clear out any previous value
:0 # rather than recounting, compare saved size to threshold; extract From:
* $ $SIZE^0
* -500000^0
* .5^0 ^\/From:.+
{
LOG="Huge item received: $SIZE bytes
${MATCH-without a From: header}
"
LOGABSTRACT=all
:0:
$TRASH
}
Here's another; its logic is more streamlined but it counts the bytes twice,
:0 # if over threshold, register size as a score
* > 500000
* 1^1 > 1
{
SIZE = $=
MATCH
:0
* ^\/From:.+
{ }
LOG="Huge item received: $SIZE bytes
${MATCH-without a From: header}
"
LOGABSTRACT=all
:0:
$TRASH
}
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail