xela: Photo of me (Default)
[personal profile] xela
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 lord@emf.net -or -to lord@emf.net -or \
          -cc lord@emf.net -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 item.to(fsb@crynwr.com) or item.cc(fsb@crynwr.com):
        for user in ["lord@emf.net", ... ]:
            if item.to(user) or item.cc(user) or item.from(user):
                trash(item)

        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 item.body.parts:
            if element.type != 'application/pdf':
                delete(element)
        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....

Date: 2007-11-01 07:54 pm (UTC)
ckd: (cpu)
From: [personal profile] ckd
Consider Sieve; you would probably have to switch IMAP servers to take advantage of it, though.

Unfortunately it looks like the Sieve remove-attach I-D died, so that last example isn't doable.

Date: 2007-11-01 08:28 pm (UTC)
jered: (Default)
From: [personal profile] jered
I second this -- you want Sieve. I use this on my mail server, and it makes me extra happy because I don't consider client-side filtering valid -- my iPhone doesn't have filter rules, so it better happen on the server!

MIT uses Cyrus, so if this is for your MIT mail you may be in luck. I'm not sure if they have a public interface for getting to sieve, though...

BTW, there are even user-friendly front-ends (sieveshell) for people who don't understand coding. This is useful for my home server as well.

Date: 2007-11-01 09:11 pm (UTC)
siderea: (Default)
From: [personal profile] siderea
I'll be interested to look into what people come up with.

I will observe that your second example is pretty much what procmail was born to do:
:0
^(To:|Cc:).*fsb\@crynwr.com
# if To or Cc "fsb@crynwr.com" (@s must be escaped), do everything in the following block:

{

:0
^(To|Cc|From):.*(lord\@emf.com|foo\@bar.com)
#if To, Cc, or From any of these addresses
$MAILDIR/trash/.
#circular file

:0
$MAILDIR/fsb/.
#otherwise, file in fsb.

}

Date: 2007-11-02 06:13 pm (UTC)
From: [identity profile] alierak.livejournal.com
I don't think the problem was that procmail couldn't do what he wanted, just that he found it revolting.

Date: 2007-11-02 07:47 am (UTC)
From: [identity profile] eichin.livejournal.com
sounds like you could just use python's imaplib... there's a hack (in the top level of my athena homedir, I think) to get imaplib to run imtest underneath so you can trivially do the authentication needed for MIT's mailstore specifically...

Date: 2007-11-02 09:42 am (UTC)
From: [identity profile] motodraconis.livejournal.com
Can't help you on code problems. :-)

But I just wanted to say, when I got back home late on my birthday I found a parcel waiting for me.
What a lovely surprise! Thankyou very much... I am a huge fan of Frezzato (his artwork is utterly gorgeous.) And, I'm a huge fan of Spaced too. Dunno if you know much about the series, but it's cult British comedy, the sort of thing where if you were ever a student in a shared house in Britain you find yourself nodding away going "oh my god! That's me! And that's all my mates."
Arf! It is just utter class, I literally end up crying with laughter at it. (Used to watch it loads, but my ex took the dvd's when he left, but now I have my own copies - Raaah!)
No idea how it'd go down to a US audience, (apparently Fox are going to destroy re-make it for the US.)

Date: 2007-11-04 07:04 pm (UTC)
From: [identity profile] yakshaver.livejournal.com
You're welcome. I haven't seen Spaced — though having just googled it and found out it stars two of my favorite Doctor Who guest stars, I very much want to. I'm unlikely to watch the Fox version, though. Roughly twenty years ago I saw the trailer for the Hollywood/Richard Pryor remake of one of my favorite films of all time, Pierre Richard's Le Jouet. I just sat there going how could they do that?, and have pretty much avoided remakes ever since. Hollywood remakes also contribute to our cultural insularism. Le Jouet used to show up regularly at art houses, advertised as The Toy and running with subtitles. As best I can tell, it was pulled from US distribution when they made the deal with Richard Pryor, and hasn't been seen here since. A show like Queer as Folk might have eventually developed enough word of mouth for an American DVD release — but since there's an American version, it'll never happen. But I'm meandering....

Date: 2007-11-04 08:12 pm (UTC)
From: [identity profile] motodraconis.livejournal.com
Urrrgh! Steer clear of US remakes.

I saw a documentary on the US remake of "Men Behaving Badly" a very popular UK sitcom of the 90's. The whole point of Men Behaving Badly was that the main protagonists were slobby, scruffy types with loutish brit-bloke beer-swilling mannerisms. Their house was dirty and scruffy, they wore food-stained clothes, they were not handsome, indeed, they were a bit ugly. In fact, perfectly recognisable young lads that fart and burp a lot.

The US version had them scrubbed up, carefully selected to be perfect, polished beauties, in smart clothes and aspirational smart house with none of the oafish (unattractive) mannerisms. What the foosh?

HORRIBLE HORRIBLE! Well, you've seen Rab C Nesbit, he's extreme but that's what brit comedy is all about... ugly, grotty people, being a bit rubbish. We love it!
There's a lot of american stuff on tv in the UK, stuff like "Friends" or OC Country, I dunno, I can't watch the stuff. It annoys me to death that everyone looks so polished and perfect, even shop workers look like they've just stepped out of a plastic surgery salon or summat.

Well, maybe I exaggerate a little. I can't really talk, I've never managed to watch longer than 5 minutes of "Friends" before having to walk out in disgust and puke (if trapped in someone elses house - in my own home 10 seconds is all I can stand before diving for the remote control.)

Ooops! Small rant unleashed there!

Date: 2007-11-05 04:49 am (UTC)
From: [identity profile] yakshaver.livejournal.com
I am (on the off chance you haven't figured it out) not an especially typical American. I caught about five minutes of an episode of Friends once, and then, since it was being watched raptly by the girl I had just started dating at the time, quietly made my way out of the room without saying what I was thinking, which was something to the effect of You watch this crap? And while I do have a wide-screen TV in my livingroom, I don't actually get television: I use it to watch DVDs and stuff I download from the Internet.

Hollywood is a fantasy land in more ways than one, including being an object of fantasy for many Americans. Attractive kids all over the country hear from a very young age you could make it big in Hollywood. Most of them couldn't, of course, but a lot try. Which from all I've heard (I've never been there) means that even menial jobs there tend to be filled by well-dressed, good looking people. I remember seeing a comedian once, a short Jewish guy from New York, playing on that as part of his schtick. He was talking about the first time he went to L.A.
I walked outside and this gorgeous six-foot blonde walks by, most beautiful woman I've ever seen in my life, and I'm thinking she must be some huge movie star. Turns out she's my waitress, and the whole damned town is packed wall-to-wall with six foot tall blondes, most of 'em even better looking than her. I thought I'd died and gone to Sweden — but with beaches and palm trees.
For like ten years before Star Wars, Harrison Ford was working as a carpenter in Hollywood. Think about living in a town where the guy who fixes your porch stairs looks like Harrison Ford. I suspect most of the people responsible for what goes on the tube haven't spent three days in a row around normal looking people since their teens.

Profile

xela: Photo of me (Default)
xela

November 2022

S M T W T F S
  12345
6789101112
13141516171819
202122 23242526
27282930   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 27th, 2026 09:26 pm
Powered by Dreamwidth Studios