"Andre Nathan" <andre@digirati.com.br> writes:
Bertram Scharpf said:
My Procmail could be configured calling just some Ruby
scripts. That leads me to the question: Is there something
like Getmail in Ruby?
There's gurgitate-mail
(http://www.dagbrown.com/software/gurgitate-mail/\), though I never had
the chance to use it.
There is! I use it for all my email. 
Now lemme see, does ruby-talk via email have the same References:
headers as it does on Usenet? I read it as comp.lang.ruby rather
than as the mailing list. (Gnus scorefiles are quite nice. Me, I
score Ilias threads *up* because I enjoy a good laugh.)
Anyway, in your .gurgitate-rules.rb, you'd want to do something like:
if to =~ /ruby-talk/ then
# deal with, er, a nuisance first (apologies to any others
# posting to ruby-talk via that host, though)
if headers["References"] =~ /usenet.otenet.gr/ or
headers["Message-ID"] =~ /usenet.otenet.gr/ then
delete
return # unless you really want to process these some more
else
return save("=ruby-talk")
end
end
If you want to grab your mail via POP from a mail server, you can
write something like this:
username='username'
password='password'
server='popserver'
require 'net/pop'
require 'gurgitate-mail'
Net::POP3.start(server,'pop3',username,password) do |popconnection|
popconnection.mails.each do |mess|
# This uses your .gurgitate-rules.rb to sort the messages
Gurgitate::Gurgitate.new(m.all.gsub(/\r/,'')).process
m.delete
end
end
But your own script might want to have more error handling in it
just in case things go wrong.
(Note: I consider downloading email message via pop or imap,
through gurgitate, to be such a simple task that I haven't even
bothered documenting it in gurgitate-mail. I suppose I should,
though, since people ask about it every now and then.)
--Dave
···
--
"Its about time you enlish Nazi's got a grip, and relized your not at
all important. The very fact that i ackowledg your existence just shows
I need more work to do here at work." (sic)
-- Slashdot luser "geekoid" responds to criticisms of Slashdot's grammar