From: Dick Davies Date: 2004-11-11T07:40:24+09:00 Subject: Re: Ruby and Mozilla? * Hal Fulton [1110 22:10]: > Dick Davies wrote: > >I think what's being suggested is to code your own pop3 server - I'm > >assuming > >Bradley meant localhost:110 when he said "local host's mail port" - that's > >actually fairly simple (pop3 is a pretty trivial protocol, and the ruby > >pop3 > >library should do all the client side for you)). > > I've played with the client stuff quite a bit, and it's not hard. > > I'm surprised to hear anyone say it would be trivial to write a POP3 server, > though. How trivial?? Ah, but we're talking about a *proxy* not a server - what I meant by simple is that there are relatively few commands, and they're just plain text so you can just forward to the real server. ( possibly misleading half-remembered technical stuff ahoy ) From what I remember of it, the basics of the protocol are just: telnet some.popserver.com 110 user username pass password bing - you're logged in, then list : list messages and sizes retr n : dump message n <-- this is the only bit you need to bugger about with top n x : show x first lines of message n dele n : delete message n quit (that's almost certainly partly wrong, check the rfc to be sure). So for your purposes, you just want to : listen on localhost port 110, open a socket to realpopserver.net on port 110, send whatever strings you recieve from your client to the real server, and send the response back to the client. That should be knock-uppable[1] in an afternoon, then you extend it so if the request string starts with retr you push the response from the server through your spamfilter before passing on to the client. Once you're confident its working, you can just 'dele' the message off the main server. Obviously that's a simplification (security wise I wouldn't be happy with the risk of other local users getting my authenticated session, for example) but it's certainly doable... not by me though, happily :) > >[ Hats off to whoever wrote our Net::IMAP libs incidentally, they are a > >joy to use. ] > > Quite right, I spent a few weeks working with IMAP, and it's a great lib. > Isn't that Shugo Maeda's work? Mr. mod_ruby? So it is. "Respec'", as we say in the ghetto.... [1] - I invented a new word - do I get it named after me? -- Rasputin :: Jack of All Trades - Master of Nuns