mbox parsing, specifically message body

Ryan Clough cloughrm at gmail.com
Thu Jun 14 21:57:47 CEST 2012

Hello everyone, 

Is anyone familiar with a simple way to parse mbox emails in Python?  I use Mail::MBoxParser in perl and it provides a simple way to grab the bodies from the emails.  In my research online, people have suggested searching for lines starting with "From ", but this doesn't seem reliable to me.  I am using the built in mailbox module and am able to do something like:

import mailbox
for message in mbox:
print message['subject']

It would be great if you could do something like the following:
print messages['body']

Any thoughts are appreciated.

Thanks, Ryan 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120614/38706d29/attachment-0001.html>

More information about the Python-list mailing list