procmail
[Top] [All Lists]

Re: Multiple rules

2002-09-12 09:48:00
At 11:06 2002-09-12 -0500, Mr/Ms. Archive did say:

I am a subscriber of many different mailing lists.  Some people put the list
address in to, some in from, and some in cc.  For example, to sort this list
I am using the following:

[chomp]

Is there an easier way to do this?

Yes - don't filter based on where you're seeing it addressed to. Filter on a characteristic list header. View the headers of any message from the Procmail list, and you'll see the following headers which are added by the list:

Return-Path: <procmail-admin(_at_)Lists(_dot_)RWTH-Aachen(_dot_)DE>
Sender: procmail-admin(_at_)Lists(_dot_)RWTH-Aachen(_dot_)DE
Errors-To: procmail-admin(_at_)Lists(_dot_)RWTH-Aachen(_dot_)DE
X-BeenThere: procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
X-Mailman-Version: 2.0.12
Precedence: bulk
List-Help: 
<mailto:procmail-request(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE?subject=help>
List-Post: <mailto:procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE>
List-Subscribe: <http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail>,
        
<mailto:procmail-request(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE?subject=subscribe>
List-Id: discussion of the procmail program <procmail.lists.RWTH-Aachen.DE>
List-Unsubscribe: <http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail>,
        
<mailto:procmail-request(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE?subject=unsubscribe>
List-Archive: <http://MailMan.RWTH-Aachen.DE/pipermail/procmail/>


Hot mamma, there's plenty of things you can match on - sender is used by a lot of mail processors, and so that makes it a pretty good default to look for when you subscribe to a new list. Otherwise, the X-BeenThere would work fine here, or the From_ or Return-Path.

:0:
* ^Sender: procmail-admin(_at_)Lists\(_dot_)RWTH-Aachen\(_dot_)DE
procmail(_at_)Lists(_dot_)RWTH-Aachen(_dot_)DE

(Note addition of escapes for the dot, which is otherwise a WILDCARD)

This will catch list messages even when the list was Bcc'd (though you might prefer to just toss those puppies in the trash - nobody has ANY business Bcc'ing a mailing list such as this).

I follow my "from the list" filter with one that discards those annoying carbons by using the ^TO macro to match the cleartexted recipient to the list basically, To: and Cc:, though other headers get checked for, they're not applicable in this instance).

Note that the From: shouldn't ever be the list address anyway, so your own filters could be condensed down to:

:0:
* ^TO:(_dot_)*procmail(_at_)lists\(_dot_)rwth-aachen\(_dot_)de
procmail(_at_)Lists(_dot_)RWTH-Aachen(_dot_)DE

OTOH, procmail-users(_at_)procmail(_dot_)org is another list address for this same list (it is the address which appears in the procmail help in more recent versions), so your approach would need an OR operation to match either listaddress, whereas the Sender method above will still match (the backend of the lists is just one list).

* 
^TO:.*(procmail(_at_)lists(_dot_)rwth-aachen(_dot_)de|procmail-users(_at_)procmail\(_dot_)org)


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