Usenet like killfiles for email

Bob Bell bbell at hp.com
Wed Oct 6 09:08:01 EDT 2004


Bill McGonigle <bill at bfccomputing.com> writes:
> I was thinking last time there was a topic amok - are there any MUA's
> that have something like the old usenet 'killfile' functionality?

I was thinking that with a mail reader that let's you bind a key to
pipe a message to a command, you could come up with a fairly simple
system that then uses procmail to actually perform the filtering.  Bind
a key to pipe the message through formail and extract the filtering
criteria and append the output to a file.  Use a fixed procmail script
that discards incoming email that matches the criteria in the file.  You
could even bind multiple keys to filter based on different criteria
(subject, from address, etc.).

For example, in your muttrc:
macro index ,k '|formail -x Subject:|sed "s/^ *re://i" >> ~/.killfile'

In your procmailrc:
:0 Wh
| /usr/local/bin/killfilter

/usr/local/bin/killfilter:
#!/bin/sh
subject=$(formail -x Subject:|sed "s/^ *re://i")
cat ~/.killfile.subject | while read k; do
    [ $k = $subject ] && exit 0
done
exit 1

NOTE: I haven't tried any of the above, but if you are interested,
hopefully it's enough to get you started.

-- 
Bob Bell



More information about the gnhlug-discuss mailing list