procmail
[Top] [All Lists]

Re: Detecting multiple To: headers?

1999-05-12 01:55:53
On Tue, 11 May 1999 22:46:55 -0400, Timothy J Luoma
<tjlists(_at_)bigfoot(_dot_)com> wrote:
Replying to message of 11 May 1999 23:13:40 -0000
     from John Conover <conover(_at_)inow(_dot_)com>
Is it possible to detect messages with multiple "To:" header records?
Wouldn't this do it?
:0
* ^To:
* ^To:
{ LOG="Multiple To lines" }

No, it simply checks that the condition is still true when Procmail
looks again. 

Try this:

    :0
    * ^To:(.+$)+To:
    ... whatever action

If you want to check for multiple recipients, this will not cut it.
You should be using ^TO_ or something like it (it obviously checks
only for recipients whose addresses are in the headers, i.e. not Bcc:s
etc; and it checks for all possible recipients, when you could be the
sole recipient in Resent-To: while there could be any number of "fake"
recipients in the To: and Cc: headers of that message. [Resent-To:
overrides To: so if there is a Resent-To:, the To: etc headers don't
apply to this delivery at all.]) and also note that there could be
several recipients in a single To: header (separated by commas, but if
the commas are in comments, they are obviously not address
separators). 

Exercise: Count the number of actual recipients in these headers:

    From: tom
    To: dick, harry
    Resent-From: dick
    Resent-To: boss (he's the main man, you know)
    Resent-Cc: janet (boss's secretary, FYI), lucy (dick's secretary, FYI)
    X-cuse-me: Enforcing gender stereotypes again, are we?
    Resent-Cc: (oh, I almost forgot (stupid me):) "Master, Post" <postmaster>

I'm not even sure if these are completely syntactically valid, but the
point should be clear: Counting matches on a smallish set of regular
expressions won't (easily) get you the desired result.

/* era */

See also <http://www.qz.to/~eli/faqs/addressing.html> (the appendix on
valid addressing forms in particular)

-- 
.obBotBait: It shouldn't even matter whether     <http://www.iki.fi/era/>
I am a resident of the state of Washington. <http://members.xoom.com/procmail/>
 * Sign the European spam petition! <http://www.politik-digital.de/spam/en/> *

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