# .procmailrc rules just don't work!!!

## Ben2040

Hi

I am using the following .procmailrc rules to filter my mailing list messages away from all the other mail, but the results are patchy at best:

```

:0

* ^To:.xorg\@freedesktop\.org

.Benjamin.XOrg/

:0

* ^CC:.xorg\@freedesktop\.org

.Benjamin.XOrg/

:0

* ^To:.kde*\@*\.kde\.org

.Benjamin.KDE/

:0

* ^CC:.kde*\@*\.kde\.org

.Benjamin.KDE/

:0

* ^To:.gnome*\@*\.gnome\.org

.Benjamin.Gnome/

:0

* ^CC:.gnome*\@*\.gnome\.org

.Benjamin.Gnome/

:0

* ^To:.gentoo-user\@lists\.gentoo\.org

.Benjamin.Gentoo\ User/

:0

* ^CC:.gentoo-user\@lists\.gentoo\.org

.Benjamin.Gentoo\ User/

:0

* ^To:.gentoo-dev\@lists\.gentoo\.org

.Benjamin.Gentoo\ Dev/

:0

* ^CC:.gentoo-dev\@lists\.gentoo\.org

.Benjamin.Gentoo\ Dev/

:0

* ^To:.gentoo-amd64\@lists\.gentoo\.org

.Benjamin.Gentoo\ AMD64/

:0

* ^CC:.gentoo-amd64\@lists\.gentoo\.org

.Benjamin.Gentoo\ AMD64/

:0

* ^To:.xdg\@lists\.freedesktop\.org

.Benjamin.FreeDesktop/

:0

* ^CC:.xdg\@lists\.freedesktop\.org

.Benjamin.FreeDesktop/

```

Why does this not filter all of the messages - I have played around with wildcards, escaping characters and such, but not all (just some) mail is filtered.

Mabye there is an easier way to filter mailing list messages, (what is it???)

Thanks

Ben

EDIT::: Forgot to mention this is on an IMAP server, at home - with the mail being accessed with various applications (Mail.app, KMail, Outlook etc.)

----------

## Nil_Spaar

As for a better way to filter mailing lists: Some (good) maillings lists have some kind of id line in their mails. Filtering for those is imho more reliable than filtering for To or CC. e.g. :

```

* ^List-Id: <debian-news\.lists\.debian\.org>

* ^Mailing-List: list amberess\@yahoogroups\.com; contact amberess-owner\@yahoogroups\.com

```

I don't know why your rules don't work. It would help a lot if you would provide an example that got not filtered properly and the rule you think should have matched.

But to take a guess, it seems to me you rather misuse the '*' wildcard. It does not stand for 'match any string' but for 'match the previous token zero to infinity times'. So e.g. "gnome*" does match "gnom", "gnome", "gnomee", "gnomeee", "gnomeeee", "gnomeeeee" and so on, but it does not match "gnome-devel". This is rather different from e.g. how bash handles '*' but considering the theory behind regexps this is the "proper" way to do it.

----------

## sumerian

 *Quote:*   

> :0
> 
> * ^CC:.xorg\@freedesktop\.org
> 
> .Benjamin.XOrg/ 

 

Taking this one example,

1. The "@" character does not need escaping.

2. People put all sorts of junk in To: and Cc: headers.  Are you sure you don't want CC:.* instead of CC:.

----------

## Ben2040

 *sumerian wrote:*   

>  *Quote:*   :0
> 
> * ^CC:.xorg\@freedesktop\.org
> 
> .Benjamin.XOrg/  
> ...

 

No, I used this filtering method on the client side (in Mail.app) - of finding the To: or CC: lines - and it 100% reliably finds every mailing list message. This is because all the messages are either directly sent to the mailing list or To: the person they are replying to, with the CC: set to the mailing list.

As for Nil_Spaar, that explains a lot then, as the unfiltered messages are from gnome-devel, etc. How come they changed the wildcard rules???

I will try out the "Mailing-List" filters now.

Thanks very much

Ben

----------

## Ben2040

```

:0

* ^List-Id: <xorg\.lists\.freedesktop\.org>

.Benjamin.XOrg/

```

OK, the above code seems to be ignored completely....

HELP!!!  :Very Happy: 

Ben

----------

## Nil_Spaar

 *Ben2040 wrote:*   

> 
> 
> No, I used this filtering method on the client side (in Mail.app) - of finding the To: or CC: lines - and it 100% reliably finds every mailing list message. This is because all the messages are either directly sent to the mailing list or To: the person they are replying to, with the CC: set to the mailing list.
> 
> 

 

Good for you if this works. Some mailinglists at my university are severely misconfigured and I half the mails would slip through such filters. (Actually they are so borken that it's hard to filter them with any kind of rule ;(

 *Quote:*   

> 
> 
> As for Nil_Spaar, that explains a lot then, as the unfiltered messages are from gnome-devel, etc. How come they changed the wildcard rules???
> 
> 

 

They didn't change them. That's the way regexp originally work. The bash/MSDos way of handling '*' is actually the changed way.

 *Ben2040 wrote:*   

> 
> 
> ```
> 
> :0
> ...

 

Can you post the part of the mail that the above rule is supposed to match please? The rule looks ok at first sight and without an example mail I can't say where the problem is.

----------

## Ben2040

 *Nil_Spaar wrote:*   

>  *Ben2040 wrote:*   
> 
> No, I used this filtering method on the client side (in Mail.app) - of finding the To: or CC: lines - and it 100% reliably finds every mailing list message. This is because all the messages are either directly sent to the mailing list or To: the person they are replying to, with the CC: set to the mailing list.
> 
>  
> ...

 

Thanks for clarification on the regexp thing - you really do learn something new everyday  :Smile: 

As for the messages not a single one is filtered, so I presume every rule has the same error. Here is a message that was suppose to be filtered for that rule in particular:

```

Return-Path: <xorg-bounces@lists.freedesktop.org>

Received: from customermail.easily.co.uk [217.206.220.10]

   by localhost with POP3 (fetchmail-6.2.5)

   for serveruser@localhost (single-drop); Fri, 08 Jul 2005 12:50:35 +0100 (BST)

Received: from [213.152.250.13] (HELO deimos.easily.co.uk)

  by easily.co.uk (CommuniGate Pro SMTP 4.1.3)

  with ESMTP id 130264199 for vq8nr1plbvn1@customermail.easily.co.uk; Thu, 07 Jul 2005 21:36:50 +0100

Received: from [131.252.208.82] (helo=gabe.freedesktop.org) 

   by deimos.easily.co.uk with esmtp (NetBenefit 2.0)

   id 1DqdDN-0003CG-WC 

   for Ben@benjaminallen.co.uk; Thu, 07 Jul 2005 21:43:22 +0100

Received: from gabe.freedesktop.org (localhost.localdomain [127.0.0.1])

   by gabe.freedesktop.org (Postfix) with ESMTP id EC9319F05D;

   Thu,  7 Jul 2005 13:35:43 -0700 (PDT)

X-Original-To: xorg@lists.freedesktop.org

Delivered-To: xorg@lists.freedesktop.org

Received: from vsmtp1.tin.it (vsmtp1.tin.it [212.216.176.141])

   by gabe.freedesktop.org (Postfix) with ESMTP id E22BD9EA7C

   for <xorg@lists.freedesktop.org>; Thu,  7 Jul 2005 13:35:37 -0700 (PDT)

Received: from nyarlathotep (80.180.85.203) by vsmtp1.tin.it (7.2.060.1)

   id 42CD13DD00046CEA for xorg@lists.freedesktop.org;

   Thu, 7 Jul 2005 22:35:31 +0200

From: Davide Zanon <d.zanon@infinito.it>

To: xorg@lists.freedesktop.org

Date: Fri, 8 Jul 2005 00:35:33 +0200

User-Agent: KMail/1.8.1

MIME-Version: 1.0

Content-Type: text/plain;

  charset="us-ascii"

Content-Transfer-Encoding: 7bit

Content-Disposition: inline

Message-Id: <200507080035.33896.d.zanon@infinito.it>

Subject: Xorg on Darwin 8.0.1 help needed

X-BeenThere: xorg@lists.freedesktop.org

X-Mailman-Version: 2.1.5

Precedence: list

List-Id: Discuss issues related to the xorg tree <xorg.lists.freedesktop.org>

List-Unsubscribe: <http://lists.freedesktop.org/mailman/listinfo/xorg>,

   <mailto:xorg-request@lists.freedesktop.org?subject=unsubscribe>

List-Archive: <http://lists.freedesktop.org/archives/xorg>

List-Post: <mailto:xorg@lists.freedesktop.org>

List-Help: <mailto:xorg-request@lists.freedesktop.org?subject=help>

List-Subscribe: <http://lists.freedesktop.org/mailman/listinfo/xorg>,

   <mailto:xorg-request@lists.freedesktop.org?subject=subscribe>

Sender: xorg-bounces@lists.freedesktop.org

Errors-To: xorg-bounces@lists.freedesktop.org

X-Originally-To: ben@benjaminallen.co.uk

X-UID: 453

X-Length: 3190

-------------------

[message...]

----------

## jamapii

The List-Id doesn't match at all. It is 

```
List-Id: Discuss issues related to the xorg tree <xorg.lists.freedesktop.org>
```

The procmail filter rule would be

```
:0

* ^List-Id: Discuss issues related to the xorg tree <xorg\.lists\.freedesktop\.org>

.Benjamin.XOrg/
```

or more simple and generic

```
:0

* ^List-Id:.*<xorg\.lists\.freedesktop\.org>

.Benjamin.XOrg/
```

Is the ":0" correct? I always use ":0:" to do locking.

----------

## Ben2040

 *jamapii wrote:*   

> The List-Id doesn't match at all. It is 
> 
> ```
> List-Id: Discuss issues related to the xorg tree <xorg.lists.freedesktop.org>
> ```
> ...

 

No, even with the specific list-id line the mails are still not affected.

I have also made sure that it is not happening to all my filter rules, because I have some basic ones and they work fine.

Thanks

Ben

----------

## jamapii

To make the To: and CC: rules more robust, you can use the ^TO_address@example.com form as described in "man procmailrc" (search for TO_).

----------

