Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #33130 > unrolled thread

Question about email.message_from_string() and Message objects

Started bytinnews@isbd.co.uk
First post2012-11-11 15:14 +0000
Last post2012-11-11 17:38 +0000
Articles 2 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  Question about email.message_from_string() and Message objects tinnews@isbd.co.uk - 2012-11-11 15:14 +0000
    Re: Question about email.message_from_string() and Message objects tinnews@isbd.co.uk - 2012-11-11 17:38 +0000

#33130 — Question about email.message_from_string() and Message objects

Fromtinnews@isbd.co.uk
Date2012-11-11 15:14 +0000
SubjectQuestion about email.message_from_string() and Message objects
Message-ID<9vr4n9-t2h.ln1@chris.zbmc.eu>
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)

-- 
Chris Green

[toc] | [next] | [standalone]


#33136

Fromtinnews@isbd.co.uk
Date2012-11-11 17:38 +0000
Message-ID<gd45n9-lli.ln1@chris.zbmc.eu>
In reply to#33130
tinnews@isbd.co.uk 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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web