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


Groups > comp.lang.python > #75969

Re: how to get the subject of email?

Date 2014-08-09 22:52 -0700
From luofeiyu <elearn2014@gmail.com>
Subject Re: how to get the subject of email?
References <mailman.12805.1407635303.18130.python-list@python.org> <ls6jp2$feg$2@reader1.panix.com>
Newsgroups comp.lang.python
Message-ID <mailman.12808.1407649929.18130.python-list@python.org> (permalink)

Show all headers | View raw


think you ,i get it .
message = email.message_from_bytes(text)
print(message['Subject'])  #can get the subject

But how can i get the body content of message?

  message['Body']  or message['Content'] can get none.


On 8/9/2014 7:01 PM, John Gordon wrote:
> In <mailman.12805.1407635303.18130.python-list@python.org> luofeiyu <elearn2014@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.
>

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

how to get the subject of email? luofeiyu <elearn2014@gmail.com> - 2014-08-09 18:41 -0700
  Re: how to get the subject of email? John Gordon <gordon@panix.com> - 2014-08-10 02:01 +0000
    Re: how to get the subject of email? luofeiyu <elearn2014@gmail.com> - 2014-08-09 22:37 -0700
    Re: how to get the subject of email? luofeiyu <elearn2014@gmail.com> - 2014-08-09 22:52 -0700

csiph-web