Working with email and mailbox module

Nirnimesh nirnimesh at gmail.com
Thu Sep 21 08:04:32 EDT 2006


I want to extract emails from an mbox-type file which contains a number
of individual emails.

I tried the python mailbox and email modules individually, but I'm
unable to combine them to get what I want. Mailbox allows me to iterate
over all the mails but doesn't give me access the individual messages
of a multipart mail. The email.Message module provides this, but I'm
unable to iterate through all the messages with this module.

Here's what I want:

Get a list of all messages from mbox-file
For each message, be able to read the header or body individually (so
that I can apply some operation)

Does someone have experience in doing something of this sort?




More information about the Python-list mailing list