message object just like the one we built to send the message walk generator allows us to step through each partfetching their types and payloadstext same as in prior interaction 'content-typemultipart/mixedboundary="=============== =="\nmime-ver from email parser import parser msg parser(parsestr(textmsg['from''art for part in msg walk()print(part get_content_type()print(part get_payload()print(multipart/mixed [text/plain nice red uniforms text/plain line line line multipart alternative messages (with text and html renditions of the same messagecan be composed and parsed in similar fashion because email clients are able to parse and compose messages with simple object-based apithey are freed to focus on userinterface instead of text processing unicodeinternationalizationand the python email package now that 've shown you how "coolthe email package isi unfortunately need to let you know that it' not completely operational in python the email package works as shown for simple messagesbut is severely impacted by python ' unicode/bytes string dichotomy in number of ways in shortthe email package in python is still somewhat coded to operate in the realm of str text strings because these have become unicode in xand because some tools that email uses are now oriented toward bytes stringswhich do not mix freely with stra variety of conflicts crop up and cause issues for programs that depend upon this module at this writinga new version of email is being developed which will handle bytes and unicode encodings betterbut the going consensus is that it won' be folded back into python until release or laterlong after this book' release although few patches client-side scripting