procmail
[Top] [All Lists]

Re: Checking if there is only one recipient

2002-10-01 11:29:31
At 11:31 2002-10-01 -0600, his Kremeness wrote:
I'd like to check incoming messages to see if there is more than one recipient (in the To: and Cc:, obviously I can't know if there's a Bcc:) but I'm not sure where to start

Hit the archives. There was discussion of a recipe to identify multiple like-named recipients in a message (for spam detection) about two or three months ago. The archives offer a plethora of guidance, if people would just refer to them...

Basically, just use formail to extract the recipients (To and Cc fields) into a variable, or use a couple of procmail MATCH rules to do so. Then, count the @ signs which appear to be part of an address, using scoring on the extracted variable:

* $ 1^1 RECIPIENTS ?? (\<)${KEYADDR}(_at_)[-a-z0-9_]+\(_dot_)

the $KEYADDR was the first "this-domain" address matched - you could substitute the character class after the at, plus dot and plus:

* $ 1^1 RECIPIENTS ?? (\<)[-a-z0-9_\(_dot_)\+](_at_)[-a-z0-9_]+\(_dot_)

the score ($=) would be equal to the number of apparent recipients. All bets are off with turkeys who use name text incorporating an @, but generally speaking, the above address expression is intended to largely reduce those mismatches.

---
 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(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>