procmail
[Top] [All Lists]

Re: X-Frequent-Sender

2001-07-27 12:35:54
Kalvis (if I remember her [his?] name right) has this code:

J> :0 f: FrequentSender.lock
J>        * ? /usr/bin/formail -r -D $CACHESIZE /root/.ProcmailCache1
J>        * ? /usr/bin/formail -r -D $CACHESIZE /root/.ProcmailCache2
J>        * ? /usr/bin/formail -r -D $CACHESIZE /root/.ProcmailCache3
J>        |formail  -a X-Frequent-Sender:

Philip asked,

G> First of all, how is the above any better than simply using one cache
G> that's three times are large?  New addresses are going end up in all
G> three anyway.

Not as I read it, Philip.  A new address will fail the first condition,
be added to cache1, and not be tried against cache2 or cache3.  An address
that was already in cache1 but isn't yet in cache2 will pass the first
condition, fail the second, be added to cache2, and not be tried against
cache3.  An address that is in cache1 and cache2 already but not in cache3
will pass the first two conditions, fail the third, and be added to cache3. 
Only on the fourth message or later will an address already be in all three
caches, pass all three conditions, and get marked as a frequent sender.

G> Secondly, the lockfile on a recipe *only* protects the action, not the
G> conditions.  If you receive two messages at once from new addresses,
G> there's a good chance it'll corrupt one or more of your caches.

Also, the `h' (yes, Philip, I mean a lower-case letter this time) flag would
help, saving the action-line formail the trouble of processing the body, and
I'm guessing that H ?? would help on the condition lines to save those invo-
cations of formail the trouble of reading and discarding the body.

G> (As long as I'm writing...)  Since /usr/bin is in $PATH, there's no point
G> to specifying formail's path.  That only makes your recipe less portable
G> to other systems.  If you want to invoke formail, just type "formail".

... as is already working fine in the action line.

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