how to get the subject of email?

John Gordon gordon at panix.com
Sat Aug 9 22:01:06 EDT 2014


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.

-- 
John Gordon         Imagine what it must be like for a real medical doctor to
gordon at panix.com    watch 'House', or a real serial killer to watch 'Dexter'.




More information about the Python-list mailing list