Generic Listname Identification

As you might suspect, I’m subscribed to a large number of mailing lists (most of which I host myself).

One of the problems with mailing lists is that, if you use a singe email address for all your list subscriptions, there isn’t an easy way to file individual list messages based on the list name.

The other day, however, I found a rather handy procmail recipe that helps with that work…


# Generic Listname identification
# 20030517/1134 SBS     Updated to handle quoted Sender text
# 20040210/2140 SBS     Optimized to eliminate shell/sed in the fallback
#                       portion.

# First, grab stuff based on common "extra" headers inserted by lists,
# including RFC-2369 and RFC-2919 specified headers, compensating for
# text comments which have been encountered on some lists.

# Disable icky delivery notifications (if you like 'em, go ahead and enable
# them here).
COMSAT=no

:0
* 9876543210^0 ^(Sender:[       ]*owner-|X-BeenThere:[  ]*|Delivered-To:[ ]*mailing list )\/[-A-Za-z0-9_+]+
* 9876543210^0 ^(List-Post:[    ]*(

To invoke the recipe, just include it in your .procmailrc file and file the identified messages appropriately... something like this ...


LOGFILE=$HOME/procmail.log
VERBOSE=on
INCLUDERC=/usr/local/share/procmail/listname_id.rc

:0 : * ! LISTNAME ?? ^^^^ mail/$LISTNAME

[tags]mail, procmail, mailing lists[/tags]

Leave a Reply

Your email address will not be published. Required fields are marked *