Re: how to get the subject of email?

2014-08-10 Thread Mark Lawrence
On 10/08/2014 02:41, luofeiyu wrote: I am in python3.4 typ, data = x.con.fetch(b'1', '(RFC822)') #get the first email text = data[0][1] message = email.message_from_string(text).get('subject') Traceback (most recent call last): File stdin, line 1, in module File

how to get the subject of email?

2014-08-09 Thread luofeiyu
I am in python3.4 typ, data = x.con.fetch(b'1', '(RFC822)') #get the first email text = data[0][1] message = email.message_from_string(text).get('subject') Traceback (most recent call last): File stdin, line 1, in module File D:\Python34\lib\email\__init__.py, line 40, in

Re: how to get the subject of email?

2014-08-09 Thread John Gordon
In mailman.12805.1407635303.18130.python-l...@python.org luofeiyu elearn2...@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

Re: how to get the subject of email?

2014-08-09 Thread luofeiyu
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-l...@python.org

Re: how to get the subject of email?

2014-08-09 Thread luofeiyu
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