combining mailbox and email modules

Matthew Dixon Cowles matt at mondoinfo.com
Wed Sep 25 14:58:54 EDT 2002


On Wed, 25 Sep 2002 06:36:29 GMT, Bob Horvath <nospam at horvath.com>
wrote:

> I am having trouble figuring out how to get the mailbox and email
> modules to play together so that I can use email module functions on
> every mail in the mailbox.  Is there a way to feed a factory from
> the email module to mailbox module?

Yes, there is:

>>> import mailbox
>>> import email
>>> i=mailbox.Maildir("Mail/testmail",email.message_from_file)
>>> i.next()
<email.Message.Message instance at 0x812410c>
>>> i.next()
<email.Message.Message instance at 0x8124224>

Regards,
Matt



More information about the Python-list mailing list