how to get the subject of email?

luofeiyu elearn2014 at gmail.com
Sun Aug 10 01:37:22 EDT 2014


message = email.message_from_bytes(text)

I get it ,
print(message['Subject'])  #can get the subject

But how can i get the body content of message?

no , message['Body']  or message['Content']

On 8/9/2014 7:01 PM, John Gordon wrote:
> In <mailman.12805.1407635303.18130.python-list at python.org> luofeiyu <elearn2014 at gmail.com> writes:
>
>> message = email.message_from_string(str(text)).get('subject')
>> message  # nothing displayed
> Try using email.message_from_bytes() instead.
>
> Also have a look at
> http://stackoverflow.com/questions/19508393/python-email-parsing-issue
> for a question very similar to yours.  Perhaps something in the code
> will help.
>




More information about the Python-list mailing list