Re: [Evolution-hackers] extracting email to structured text (csv)



On Fri, 2008-06-27 at 10:45 +0200, simon le bayon wrote:
> Hi all of you,
> 
> thanks for you replies (in very short delay :o)
> 
> 
> I think i will do wat you propose, create a new mbox with the messages I
> want then parse it to extract data.
> 
> I'm more "experimented" in python but, this is certainly a good way to
> practice ruby.
> 
> Do you think it's useful for you, me to send results (scripts) on the
> evolution-hack list or somewhereelse ? 
> 
> thx
> Simon
> 

> > > 
> > > rubymail, or one of the other ruby mail libraries may allow you to do 
> > > what you want..
> > > 
> > > http://www.rfc20.org/rubymail/docs/
> > > 
> > > http://www.rfc20.org/rubymail/
> > > 
> > > rubymail has a parse_mbox call that might allow what you want...
> > > 
> > > found this on the web... might be modifiable for what you want.
> > > 
> > > #!/usr/bin/ruby -w
> > > # Split a mbox file into $year-$month files
> > > # Copyright (C) 2008 Joerg Jaspert
> > > # BSD style license, on Debian see /usr/share/common-licenses/BSD
> > > require 'pathname'
> > > require 'rmail'
> > > count = 0
> > > File.open(Pathname.new(ARGV[0]), 'r') do  mbox
> > >   RMail::Mailbox.parse_mbox(mbox) do  raw
> > >     count += 1
> > >     print "# count  mails\n"
> > >     begin
> > > 
> > > File.open(RMail::Parser.read(raw).header.date.strftime("split/mail-%y%m"), 
> > > 'a') do  out
> > >         out.print(raw)
> > >       end
> > >     rescue NoMethodError
> > >       print "Couldn't parse date header, ignoring broken spam mail\n"
> > >     end
> > >   end
> > > end
> > > 
> > 
> > ruby tmail is also very nice.  it should allow you to do what you want.
> > 
> > http://tmail.rubyforge.org/reference/index.html notes that it recognizes mbox, 
> > maildir, etc.
> > 

I'd be interested in seeing/using it also.

reid



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]