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:
Leaving aside how inefficient that code is, I could totally do with being able to express that instead as:# punt any discussion involving tom lord on fsb rmm `pick -lbrace -to fsb -or -cc fsb -rbrace -and \ -lbrace -from firstname.lastname@example.org -or -to email@example.com -or \ -cc firstname.lastname@example.org -rbrace `
I'd also like to be able to alter messages.for item in inbox: if item.to(email@example.com) or item.cc(firstname.lastname@example.org): for user in ["email@example.com", ... ]: if item.to(user) or item.cc(user) or item.from(user): trash(item) refile(item, fsb_folder)
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.if item.from(my_fax_service): # save a copy of the original just in case copy(message, fax_archive_folder) for element in item.body.parts: if element.type != 'application/pdf': delete(element) refile(item, faxes)
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....