[plug] Working with Mbox files

Bernd Felsche berfel at innovative.iinet.net.au
Thu Sep 4 12:25:53 WST 2008


"Nathan Alberti" <nalberti at gmail.com> wrote:

>I need to create a report for a bunch of mbox files that shows the number of
>mail received for the past 7 days and the unread count (for those messages)

>Getting the read/unread is easy enough but I'm not sure how to go about
>working with the date to limit it to the last 7 days worth of messages..

>Is there an appropriate library or convert it to something like Unix time
>and use arithmetic  ?

>I've had a look a some of the email archiving programs but nothing really
>looks to do what I want, mbox grep seems promising but I'm not sure how to
>go about appropriate regex on the the date field

Mailbox handling...
<http://docs.python.org/lib/mailbox-objects.html>

rfc822.parsedate() does most of what you require wrt date decoding.
<http://docs.python.org/lib/module-rfc822.html>

Sample code to do something a little different at
<http://code.activestate.com/recipes/157437/>

I suspect that Ruby [ a.k.a. Python with braces :-) ] has similar
facilities.
-- 
/"\ Bernd Felsche - Innovative Reckoning, Perth, Western Australia
\ /  ASCII ribbon campaign | Science is the belief in
 X   against HTML mail     | the ignorance of the experts.
/ \  and postings          |  -- Richard Feynman




More information about the plug mailing list