procmail
[Top] [All Lists]

Re: Removing [somelist] from subject lines

2001-01-20 11:49:21
"Mike A. Harris" <mharris(_at_)opensourceadvocate(_dot_)org> writes:

I looked at the procmail faq's thinking this *must* be an faq,
however I didn't find anything.  I'm on a few lists that
idiotically insist on adding [listname] to the beginning of every
message, and I want to have procmail auto-remove this crap.

I'd prefer it if someone could point me to some faq page or other
resource out there as this almost has to be talked to death.


This can be done quite simply or with more sophicticated (complex)
rules.  I like the simple way.

Most of this is in the procmail man pages..  Your spec is to remove
unwanted material from a header line.  So `h' will be needed,  you
want to filter something so `f' will be needed.

`h' means only headers will be looked at
`f' means to filter thru something (roughly)

And the always usefull pipe.  Those three elements can make your recipe

    :0hf
    * ^Subject:.*\[lula\]
    | sed 's/\[lula\] //'

( I have one of those obnoxious groups too)

The above first traps messages with the problem subject line
then will remove `[lula]' from the subject line with sed, then let the
mail go on to your spool.  It gets more complicated if you want to
also send the message to a specific destination (not the normal
spool file), since procmail allows exactly one destination in each
rule.  The above supplies a `|' as destination so cannot have another.

If you need more it can be contained in the script you pipe to.


Before:
[...]
        Date: Wed, 03 Jan 2001 16:36:29 -0000
        Subject: [lula] Re: cable/dsl routers
[...]
        Date: Sat, 20 Jan 2001 08:22:12 -0000
        Subject: [lula] Identd [was Re: Secure your RH6.2/RH7.0 systems!]

After:
[...]
        Date: Wed, 03 Jan 2001 16:36:29 -0000
        Subject: Re: cable/dsl routers
[...]
        Date: Sat, 20 Jan 2001 08:22:12 -0000
        Subject: Identd [was Re: Secure your RH6.2/RH7.0 systems!]
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail