Question about email.message_from_string() and Message objects

tinnews at tinnews at
Sun Nov 11 18:38:24 CET 2012

tinnews at wrote:
> I'm a little confused about the relationship between the Python
> email.parser convenience function email.message_from_string() and the
> mailbox.Message objects.
> If I want an mailbox.mboxMessage given the message as a stream of text
> is the right way to do it as follows (or at least a reasonable way to
> do it):-
>     msg = email.message_from_string(messageAsAString)
>     mbxMsg = mailbox.mboxMessage(msg)
> Or can I go direct to mbox by doing:-
>     mbxMsg = mailbox.mboxMessage(messageAsAString)
Answered myself by just trying it, the simple, straightforward 

    mbxMsg = mailbox.mboxMessage(messageAsAString)

works perfectly.

Chris Green

More information about the Python-list mailing list