Alex (yakshaver) wrote,

  • Mood:

my little (mail-filtering) pony...

I'm looking for a tool to help me filter my email. Whenever I've mentioned this before, someone always mentions procmail. At which point I take a cursory look at procmail, find myself thinking about cats having hairballs, and go do something else.

But at this point, even though I have really excellent spam filtering, my mail is getting unmanageable. Before I actually dig in to the procmail hairball, I'd like to know what, if any, alternatives I should look at.

I think my pony here would be a special purpose language (or better, a python module) with which I could write scripts that I would run either directly on maildirs on my imap server (i.e. I would run them as a local user on the sserver), or that would function essentially as a scriptable imap client.

My starting point for thinking about the features I want is mh: I've been using shell scripts and mh to filter my MIT mail for years; at minimum I want the features that gives me. Which is, in a nutshell, the ability to filter on the content of any header. I could live with less annoying syntax, though:
# punt any discussion involving tom lord on fsb
rmm `pick -lbrace -to fsb -or -cc fsb -rbrace -and \  
          -lbrace -from -or -to -or \
          -cc -rbrace `
Leaving aside how inefficient that code is, I could totally do with being able to express that instead as:
for item in inbox:
    if or
        for user in ["", ... ]:
            if or or item.from(user):

        refile(item, fsb_folder)
I'd also like to be able to alter messages.
    if item.from(my_fax_service):
        # save a copy of the original just in case
        copy(message, fax_archive_folder)
        for element in
            if element.type != 'application/pdf':
        refile(item, faxes)
So, if anyone knows of a mail filtering system that would be closer to my pony than procmail, I'd love to hear about it.
Edit: Added 2007-11-01 at 19:29

I forgot to mention one of the main reasons this is a pony: I should have made clear that part of the reason I'm thinking in terms of something I can run on the files in a maildir is that I don't necessarily just want to filter mail upon receipt. For instance, I'd like to be able to run aging filters, to archive or trash messages past a certain age that match certain criteria. Or to send mail to myself saying, e.g., "You have mail in your personal inbox from Charlie that's two weeks old. You should answer that and refile it." That said, I'm not really expecting to find my pony, and am looking at sieve docs right now....
Tags: geek
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded