procmail
[Top] [All Lists]

Re: test for mailing lists

2000-06-29 10:09:44
Jan Niggemann asked,

| how do you test if mail is from a mailing-list? Please tell me the header
| fields that indicate that mail was not sent from an individual, but from a
| mailing list. Are there standards?

As Richard Travett has explained, there is no reliable standard.  List-Id: is
a proposed one, but it is not official yet (as far as I know), and even when
it becomes official it will need to spread.

For each list you're on, you need to look at a few posts and see what will
work for that list.  If List-Id: is there, use it.  Next best would be
Mailing-List: or X-Mailing-List: if the list supplies it.  You might find a
list that identifies itself in Sender: or Resent-Sender: or (if you have it)
Return-Path: or From_ (that is, the "From<space>" postmark line that might be
at the top of the message, not the From: header).  If you get a list in
digest mode, From: or Subject: or usually To: will work -- but if you use
Subject:, be sure the condition can't be matched if there's a Re: in the
subject, just in case someone sends you a private reply to a post of yours
that appeared in a digest issue and the person doesn't change the subject.

For the Procmail List, I use the X-BeenThere: header.

Some lists insert their name (or an abbreviation of it) into the subject
lines of posts.  Using that has a drawback: if somebody sends you a private
reply to a post that you wrote and doesn't change the subject, the tag from
the list will still be there, and your routines will misfile it as if it came
from the list.  (Corollary: if someone replies to a post of yours by writing
both to you and to the list, and the person doesn't change the subject, both
copies that you get -- the one sent directly to you and the one that the list
sends to you as a member -- will be filed with list distributions.)

^TO_ is probably the weakest way to match mail that came through a list, be-
cause (1) it misses items that are blind-carboned to the list and (2) if
someone answers a post of yours with a direct delivery to you plus a copy
to the list, the two copies that you get will both land in the folder for
the list, as in the corollary above.

Better to use something that showed passage through the list software, I
feel, than headers sent by the author of the post.

Even that can have problems: I used to file one of my subscriptions by the
From_ header, and nowadays I'd do that this way:

  ^^From listname(_at_)list\(_dot_)host

but at the time my email came in unpredictably with some From_ lines in bang
form and some in at form, so it had been easier to match on

  ^^From (.*!)?listname

But one subscriber to that list had a private domain and, for every list he
joined, he created a username matching the name of the list, so he would
subscribe to the foo list as foo(_at_)his(_dot_)domain, to the gurble-l list as
gurble-l(_at_)his(_dot_)domain, and so forth.  If he had been on this list, 
he'd have
subscribed to it as procmail(_at_)his(_dot_)domain(_dot_)  Well, one time I 
wrote to him
privately about something he had posted, to the reply address of his post,
which was the list's name, only @his.domain.  He wrote back to me, quoting
my message, and the From_ line on his reply was From 
listname(_at_)his(_dot_)domain
or maybe From his(_dot_)domain(_at_)listname(_dot_)  My .procmailrc saw that 
and filed his
message with the list distributions.  Well, I thought his message was a post
to the list because, after all, it was in my folder for the list, and here
were all these things I had said to him in private email!  I gave him a piece
of my mind for quoting private email to a mailing list without permission
from the quotee, and luckily for me he reacted with puzzlement rather than
comparable anger to mine.  When he wrote back to swear he had done no such
thing, the message was like the preceding one and also landed in my folder
for mail from the list.  That's when I saw what was happening, so I figured
the same thing must have happened with his earlier message, and I apologized.

I changed the condition in my .procmailrc to 

  ^^From (list\.host!listname|listname(_at_)list\(_dot_)host)

where, unfortunately, list\.host wasn't just the domain of the listhost but
a messy regexp to match the possible servers that might have handled a post
to that list.  Using messy regexp, twice no less, was why I had used the
simpler expression in the first place.

As I said, one should identify mail that came through a list by something
done by the list software rather than anything done by the author of the
post, but unknowingly I had been breaking that rule because, with no malice
intended, another member was mimicking something that appeared on list posts.


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