I warn you now - this is more than you asked for.

On 2000.06.17, in <[EMAIL PROTECTED]>,
        "Andrew Eichmann" <[EMAIL PROTECTED]> wrote:
> the subject line.  For example, if the original message's Subject:
> line is ``[BOB] What's the frequency, Kenneth?''where ``[BOB]'' is 
> the mailing list name that gets prepended to the subject, the replies 
> ...
> Is there a built-in solution to this?  Does anybody else have this
> problem?  I imagine something stripping out all variations of ``Re:''

I have this problem, too -- it's one of the reasons I can't stand lists
that alter your postings' subject: lines.

My .procmailrc loads a file named "classaction".  This file sets some
operational defaults, then loads a bunch of matching rules from another
file called "classes".  It then alters messages as documented in
"classaction".

"classaction" and a stripped-down copy of "classes" are attached.  In
reality, I process about 120 different lists and other categories of
like mail from this setup.  It's fast, but that doesn't actually matter
since it's asynch with my mail-reading.
 
"$ ${XFROM}" is a procmail macro I use for matching sender addresses.
You can substitute the built-in "^FROM" (or whatever).


You'll note that this setup only marks messages by removing [LISTNAME]
stuff from the subject (if STRIPLAB is set in the list's config), and
adds the X-Label: header.  I have mutt set up to do all its list
matching on "~y listname" instead of duplicating all the patterns, so
procmail and mutt are VERY intertwined here.

(X-Label: and "~y" are a 1.3.x thing.  This makes it easy to move a
message from one category to another in Mutt's eyes.  Once a message is
archived and delivered, it's all about Mutt, and I don't worry about
saving anything that has an X-Label: because I know it's already
archived.)

Anyway, maybe you don't want all that, but it shows how I'm using
procmail to match the expressions. :)

-- 
 -D.    [EMAIL PROTECTED]        NSIT    University of Chicago
###########################################################################
###
### Handle all mail classes properly, phase 1.
###
### These DEFAULTS hinge archival, labelling, and inbox display on whether
### ${CLASS} is defined.  For these options, you need only define ${CLASS}
### to a shorthand for the mail class a message should belong to.
###

### Nullify the class name.  If CLASS is undefined, mail will pass through
### the class-action package untouched and unarchived.  (Auto-forwarding
### will still occur, though.)  ${CLASS} implies a few things:
###     1. Name of the archival folder
###     2. Name for class labelling (X-Label header field or Subject: rewrite)
### If ${CLASS} is literally "null", mail in a given class will be killed off
### after matching.
CLASS=

### If ${CLASS} is set to someting besides "null", and ${ARCHIVE} is set,
### messages will be archived.  If ${ARCHIVE} is "yes", the archival folder's
### name will be copied from ${CLASS}.  If ${ARCHIVE} is anything else, mail
### will be archived to that folder name.
###
### The archived copy will be unadulterated.
ARCHIVE=yes

### If ${CLASS} is set to someting besides "null", and ${LABEL} is set,
### messages will have an "X-Label:" header field inserted.  If ${LABEL}
### is "yes", the X-Label will be set to ${CLASS}.  If ${LABEL} is set
### to any other value, the X-Label will be set to that value.
LABEL=yes

### If ${HARDLABEL} is "yes", rewrite
###     Subject: Re: foo
### as
###     Subject: [$LABEL] Re: foo
### instead of inserting an X-Label: header.
HARDLABEL=no

### If ${STRIPLAB} is set to "yes", remove anything enclosed in square
### brackets from the beginning, or following a leading "Re: ", of the
### Subject: header.  If ${STRIPLAB} is set to anything else, remove
### only such tags if they match ${STRIPLAB}.  This is for removing
### the tags generated by some mailing-list managers so that we can
### prefer X-Label:s.
STRIPLAB=

### If ${HIDE} is set to "yes", the class-action package will not
### store messages in a class to the default folder (inbox).  If ${HIDE}
### is unset, or set to anything besides "yes" , messages will be stored
### to the default folder IN ADDITION to any archival.  The copy in the
### default folder will be marked with "Status: O".
HIDE=no

###########################################################################
### Try to match mail to a list or class.  Multiple matches are multiply
### acted upon.
INCLUDERC=$PMDIR/classes

### If CLASS was set to "null", just ditch it and end
:0
* CLASS ?? null
/dev/null

### If CLASS was set and ARCHIVE is set, prepare to archive
:0
* CLASS ?? .+
{
        ## Check the cache for this dropbox; drop if a repeat.
        ## Rewriting the value of IDCACHE here allows each list to
        ## maintain internal uniqueness, but doesn't prevent duplicate
        ## refiles of messages aimed at two or more separate lists.
        IDCACHE=lists/`dirname $CLASS`/.`basename $CLASS`.idcache
        INCLUDERC=$PMDIR/idcheck

        ## Archive, with lock
        :0 c:
        lists/${CLASS}

        ## If hidden, bail out.
        :0
        * HIDE ?? yes
        /dev/null

        ## Mark "Old" to indicate archival, if no status was already set.
        :0 f
        | ${FORMAIL} -a "Status: O"

        ## If STRIPLAB is set and is not "yes", wipe out "[$STRIPLAB]"
        ## in the Subject:.
        ## If STRIPLAB is "yes", wipe out any "[.+]" in the Subject:.
        :0
        * STRIPLAB ?? .+
        {
                RE=""
                :0
                * SUBJECT ?? ^ *\/[rR][eE]:
                { RE="${MATCH} " }

                :0 E
                * STRIPLAB ?? yes
                * SUBJECT ?? ^ *\[[^]]+\] *\/[^ ].*
                { NEW_SUBJECT="${RE}${MATCH}" }

                :0
                * STRIPLAB ?? yes
                * SUBJECT ?? ^ *[rR][eE]: *\[[^]]+\] *\/[^ ].*
                { NEW_SUBJECT="${RE}${MATCH}" }

                :0 E
                * $ SUBJECT ?? ^ *\[${STRIPLAB}\] *[rR][eE]: *\[${STRIPLAB}\] *\/[^ ].*
                { NEW_SUBJECT="${RE}${MATCH}" }

                :0 E
                * $ SUBJECT ?? ^ *\[${STRIPLAB}\] *\/[^ ].*
                { NEW_SUBJECT="${RE}${MATCH}" }

                :0 E
                * $ SUBJECT ?? ^ *[rR][eE]: *\[${STRIPLAB}\] *\/[^ ].*
                { NEW_SUBJECT="${RE}${MATCH}" }
        }

        ## Determine the value of the label.
        :0
        * LABEL ?? yes
        { NEW_LABEL="${CLASS}" }

        :0 E
        * LABEL ?? .+
        { NEW_LABEL="${LABEL}" }

        ## If ${HARDLABEL} is "yes", rewrite the Subject: line.
        :0
        * HARDLABEL ?? yes
        {
                :0 f
                * NEW_LABEL ?? .
                * NEW_SUBJECT ?? .
                | ${FORMAIL} -i "Subject: [${NEW_LABEL}] ${NEW_SUBJECT}"

                :0 Ef
                * NEW_LABEL ?? .
                | ${FORMAIL} -i "Subject: [${NEW_LABEL}] ${SUBJECT}"

                :0 Ef
                * NEW_SUBJECT ?? .
                | ${FORMAIL} -i "Subject: ${NEW_SUBJECT}"
        }

        ## Else, no hardlabel
        :0 E
        {
                :0 f
                * NEW_LABEL ?? .
                * NEW_SUBJECT ?? .
                | ${FORMAIL} -i "Subject: ${NEW_SUBJECT}" -i "X-Label: ${NEW_LABEL}"

                :0 Ef
                * NEW_LABEL ?? .
                | ${FORMAIL} -i "X-Label: ${NEW_LABEL}"

                :0 Ef
                * NEW_SUBJECT ?? .
                | ${FORMAIL} -i "Subject: ${NEW_SUBJECT}"
        }
}

# If hidden, toss it.
:0
* HIDE ?? yes
/dev/null
###############################################################################
###
### Mail class management
###
### $Id: classes,v 1.1 2000/05/10 17:11:08 dgc Exp dgc $
###

### Try to match a class, then set some parameters for handling it.
:0
{
        ###
        ### AIX security list
        ###
        :0
        * ^Subject: (Re: )?Security
        * $ ${XFROM}aixserv@
        {
                CLASS=aix/security
        }

        ###
        ### kerberos list - not enough time to read regularly
        ###
        :0
        * $ ${XADDR}(kerberos|usenet-incoming-kerberos)@
        {
                CLASS=kerb
                HIDE=yes
        }

        ###
        ### SSH list
        ###
        :0
        * $(${XFROM}(ssh-owner|owner-ssh)[-@])|(${XTO}[^a-z]ssh@)
        {
                CLASS=ssh
                HIDE=yes
        }

        ###
        ### axp-list: yada yada
        ###
        #* ^Resent-From: [EMAIL PROTECTED]
        :0
        * $ ${XFROM}axp-list.*@redhat.com
        {
                CLASS=axp
                HIDE=yes
        }

        ###
        ### All other linux lists: sort and dump unread
        ###
        :0
        * $ ${XADDR}linux-\/[^@]@vger.rutgers.edu
        {
                CLASS=lx-$MATCH
                ARCHIVE=linux/linux-$MATCH
        }

        ###
        ### Postmaster
        ###
        :0
        * $ ${XADDR}postmaster@
        * $ ${XADDR}[EMAIL PROTECTED]
        {
                CLASS=postmaster
        }

        ###
        ### Network security
        ###
        :0
        * $ ${XADDR}(netsec|(network-)?security)@
        {
                CLASS=netsec
        }

        ###
        ### crypto-gram
        ###
        :0
        * $ ${XADDR}crypto-gram.*@chaparraltree.com
        {
                CLASS=cryptogram
        }

        ###
        ### abuse
        ###
        :0
        * $ ${XADDR}abuse@(.*.)?uchicago.edu
        {
                CLASS=abuse
        }

        ###
        ### Mutt announcements
        ###
        :0
        * $ ${XADDR}.*mutt-announce[-@]
        {
                CLASS=mutt-an
                STRIPLAB=Announce
        }

        ###
        ### Mutt users
        ###
        :0
        * $ ${XADDR}.*mutt-users[-@]
        {
                CLASS=mutt-usr
        }

        ###
        ### Mutt developers
        ###
        :0
        * $ ${XADDR}.*mutt-dev[-@]
        {
                CLASS=mutt-dev
        }

        ###
        ### Mailman users
        ###
        :0
        * $ ${XADDR}.*mailman-users[-@]
        {
                CLASS=mm-users
                STRIPLAB=Mailman-Users
        }

        ###
        ### Mailman announce
        ###
        :0
        * $ ${XADDR}.*mailman-announce[-@]
        {
                CLASS=mm-announce
                STRIPLAB=Mailman-Announce
        }
}

Reply via email to