[Exim] List filter rules

Pàgina inicial
Delete this message
Reply to this message
Autor: Nigel Metheringham
Data:  
A: exim-users
Assumpte: [Exim] List filter rules
I think long ago I said I'd post the rules I use for filtering mailing
lists. Well here they are, as an exim filter, all generic - ie they
recognise new lists and create mailboxes for them.

The mail delivery is Maildir using an organisation of folders that works
well for Courier IMAP. It should be easy to modify for other storage
schemes.

These rules successfully handle all the mailing lists I have been on in
the last year *except* RISKS which I haven't looked at to fix as yet.

    Nigel.


# 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:header_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


--
[ Nigel Metheringham           Nigel.Metheringham@??? ]
[ - Comments in this message are my own and not ITO opinion/policy - ]