[exim] Kill file filter [was Re: a large number of domains f…

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Ian FREISLICH
Dátum:  
Címzett: exim-users
Tárgy: [exim] Kill file filter [was Re: a large number of domains fronted by Exim are] refusing bounces...
Ted Cooper wrote:
> I'm really quite sick of this thread and if I was using a good enough
> email client to ignore it, I would. But, alas, I am stuck with a
> windows client and I'll just have to reply to convince you to PLEASE
> take this elsewhere.


Hear! This thread prompted me to write an exim filter kill-file
that follows threads (in a simple fashion). I only saw this part
of the thread because I was looking through the archived killed
mail to make sure it was working properly. I share the filter with
all here so that others can derive the same benefit that I do.

I'd be interested in enhancements.

It uses three files:

$home/.killfile - Put email addresses (envelope senders) you summarily
        want to kill in here.
$home/.killfile_lists - Put the list-id, X-mailing-list or the list
        envelope sender followed by a ':' and then the email
        address in the From header that you wish to kill.
$home/.killfile_message_id - This one is auto appended with the
        message ids that match the above criterion so that
        the In-reply-to and References headers can be checked
        and follow-ups to killed messages can be killed as well.


For example I currently only use:
$home/.killfile_lists
    exim-users.exim.org: woods@???


Because woods might be reasonable on some other list I'm on and he
might at some point have a valid complaint about the email service
I run.

Ian

--
Ian Freislich

# Exim filter

# Kill File
if "${lookup{$sender_address} lsearch{$home/.killfile} {yes}{no}}" is "yes" or
   "${lookup{$sender_address} lsearch{$home/.killfile_lists}{$value}{no}}" is
    "${sg{$h_from:}{^.*?<(.*?)>.*?\\$}{\\$1}}" or
   $h_list-id: matches "<(.*?)>" and
   "${lookup{$1} lsearch{$home/.killfile_lists}{$value}{no}}" is "${sg{$h_from:}{^.*?<(.*?)>.*?\\$}{\\$1}}" or
   $h_X-mailing-list: matches "([^[:space:]]*)" and
   "${lookup{$1} lsearch{$home/.killfile_lists}{$value}{no}}" is "${sg{$h_from:}{^.*?<(.*?)>.*?\\$}{\\$1}}"
then
    if "${strlen:$h_message-id:}" is above 0
    then
        logfile $home/.killfile_message_id
        logwrite "$h_message-id:: $tod_epoch"
    endif
    save $home/.mailarchive/archive.killed
    seen finish
endif


# Replies to killed mail
if $h_In-reply-to: matches "(<[^[:space:]]{10,}\\@.*?>)" and
   "${lookup{$1} lsearch{$home/.killfile_message_id}{yes}{no}}" is "yes" or
   $h_References: matches "(<[^[:space:]]{10,}\\@.*?>)" and
   "${lookup{$1} lsearch{$home/.killfile_message_id}{yes}{no}}" is "yes"
then
    if "${strlen:$h_message-id:}" is above 0
    then
        logfile $home/.killfile_message_id
        logwrite "$h_message-id:: $tod_epoch"
    endif
    save $home/.mailarchive/archive.killed
    seen finish
endif


# Make a copy of all incoming mail.
save $home/.mailarchive/archive.current

deliver $local_part@$domain