procmail
[Top] [All Lists]

Re: Munging up the subject line

1999-09-29 13:41:38
Today (Sep 29, 1999) at 20:28, Lars Hecking said:

Adam Shostack writes:
At work, we have a bunch of mailing lists which insert [Listname] into
the subject line, which annoys me, and breaks mutt threading.  So, I
want to remove the [Listname] portion.

I'm currently using a two phase rule, where first the subject is
passed to sed for reduction, and then the new subject is passed to
formail.  I'm having a lot of trouble getting the quoting right such
that $SUBJECT is set correctly when the mail is dumped into the right
folder.

(For extra guru points, it would be cool to have a single recipie that 
manages all the lists that are done in this way.)

Would something like this fit the bill?  I use a similar recipe to
digest mailing lists (I have procmail v3.11pre7.):

TAG="none"

:0
*^TOdevteam
{ TAG="devteam" }

... [define $TAG for other mailing lists] ...

:0                                  # if TAG changed, munge and deliver
* ! TAG ?? none
{
  :0 hfw                            # don't care what's in the brackets
  *$ ^Subject:[  ]+\[.*\][       ]+\/.+  
  | formail -I"Subject: $MATCH"

  :0:$TAG$LOCKEXT
  $TAG
}

Regards,

Chuck