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



Tobias Mueller wrote:
Hey Simon :)

On 18.06.2008 19:52 simon le bayon wrote:
I'm a sociology phd student, with few competences in it, and i'd like to
extract thousands of email from evolution to a csv or other structured
file.

I don't know whether mbox or maildir is structered enough and whether Evolution supports copy&paste old mails to a new mbox account. But if both facts are given, you might want to create a new mbox (or maildir) account, copy&paste your mails into that accout, so that all mails are in the mbox file and mess around with your data.

HTH,
  Tobi


------------------------------------------------------------------------

_______________________________________________
Evolution-hackers mailing list
Evolution-hackers gnome org
http://mail.gnome.org/mailman/listinfo/evolution-hackers

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


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