procmail
[Top] [All Lists]

Re: Matching # of recipients in To:?

1997-08-04 14:16:00
W. Wesley Groleau wrote,

| Scoring is a great tool, but beware the hammer/nail syndrome.

Beware of the nail-but-no-hammer syndrome.  Often it's better to get the
hammer out of the closet than to bang with one's shoe.

| How about (warning, my syntax is probably wrong)
| 
|    :0
|    * To: \/.*
|    * ? echo $MATCH | wc -w > 5

Yes, the syntax is wrong ... it needs some kind of test operator, not a
redirector ... 

    * ? [ `echo $MATCH | wc -w` -gt 5 ]

Moreover, it calls a shell and wc (let's assume that the shell has echo or
test built in) for something procmail can do by itself.

But more importantly the logic is wrong too.

First, it ignores the Cc: line, so it doesn't solve the original problem;
second, it doesn't grok Resent- headers; and third, a single address can
include more than one word, and this logic assumes that each word is yet
another address.  For example, say I wanted to answer mail from the person
who made that suggestion; his return address is

 wwgrol(_at_)sparc01(_dot_)fw(_dot_)hac(_dot_)com (W. Wesley Groleau x4923)

That's five words (by wc -w's concept of a "word") right there.  If he had
one more word in his address comment, the suggested logic would treat all
mail sent as replies to his own writing as spam.

Or suppose someone legitimately sends personal mail to him and to one other
person.  That other person's address is of the form

   user(_at_)site(_dot_)dom(_dot_)ain (Firstname Lastname)

so there are eight words after the colon in the To: line.  Eight words mean
eight addresses and six addresses mean spam, so this is spam for sure.

A decision where incoming mail must be tested against a quantitative
threshold is a nail.  Use the hammer.