On Fri, 2002-09-27 at 15:17, Martin Helas wrote:
> what you are looking for seems to be a program called procmail.
or an alternative using an exim filter (this one catches nearly all
mailing lists and stores them appropriately - the directory names are
appropriate for courierimap and give a set of folders under INBOX/list
# split out the various list forms
# Mailman & other lists using list-id
if "${if def:header_list-id:{true}}" is true then
if $header_list-id: matches "<([a-z0-9-]+)\\\\." then
save Maildir/.list.${lc:$1}/
else
save Maildir/.list.unknown/
endif
finish
# Listar and mailman like
elif "${if def:header_x-list-id:{true}}" is true then
if $header_x-list-id: matches "<([a-z0-9-]+)\\\\." then
save Maildir/.list.${lc:$1}/
else
save Maildir/.list.unknown/
endif
finish
# Ezmlm
elif "${if def:header_mailing-list:{true}}" is true then
if $header_mailing-list: matches "([a-z0-9-]+)@" then
save Maildir/.list.${lc:$1}/
else
save Maildir/.list.unknown/
endif
finish
# Smartlist
elif "${if def:header_x-loop:{true}}" is true then
# I don't have any of these to compare against now
save Maildir/.list.unknown/
finish
# poorly identified
elif $sender_address contains "owner-" then
if $sender_address matches "owner-([a-z0-9-]+)-outgoing@" then
save Maildir/.list.${lc:$1}/
elif $sender_address matches "owner-([a-z0-9-]+)@" then
save Maildir/.list.${lc:$1}/
elif $header_sender: matches "owner-([a-z0-9-]+)@" then
save Maildir/.list.${lc:$1}/
else
save Maildir/.list.unknown/
endif
finish
# other poorly identified
elif $sender_address contains "-request" then
if $sender_address matches "([a-z0-9-]+)-request@" then
save Maildir/.list.${lc:$1}/
else
save Maildir/.list.unknown/
endif
finish
# and even more crap - York list server in this case
elif "${if def:list-owner:{true}}" is true then
if $header_list-owner: matches "<(?:mailto:)(?:owner-)([a-z0-9-]+)@" then
save Maildir/.list.${lc:$3}/
else
save Maildir/.list.unknown/
endif
finish
endif
This quite nice - any new list I'm on, a folder pops up for it... just
need to clean them occasionally. BTW the regular expressions are
carefully crafted to prevent people doing attacks on me with mailing
list addresses with ../../.. in for example...
Nigel.
--
[ Nigel Metheringham Nigel.Metheringham@??? ]
[ - Comments in this message are my own and not ITO opinion/policy - ]