allow these to pass this may encroach on some smtp server issues which we don' have space to address in this book see the web for more on smtp headers handling for more on headers decodingsee also file _test- -headers py in the examples packageit decodes additional subject and address-related headers using mailtools methodsand displays them in tkinter text widget-- foretaste of how these will be displayed in pymailgui workaroundmessage text generation for binary attachment payloads is broken our last two email unicode issues are outright bugs which we must work around todaythough they will almost certainly be fixed in future python release the first breaks message text generation for all but trivial messages--the email package today no longer supports generation of full mail text for messages that contain any binary partssuch as images or audio files without coding workaroundsonly simple emails that consist entirely of text parts can be composed and generated in python ' email packageany mime-encoded binary part causes mail text generation to fail this is bit tricky to understand without poring over email' source code (whichthankfullywe can in the land of open source)but to demonstrate the issuefirst notice how simple text payloads are rendered as full message text when printed as we've already seenc:\pp \internet\emailpython from email message import message message( ['from''bob@bob comm set_payload(open('text txt'read()print(mfrombob@bob com generic message object payload is str text print uses as_string(spam spam spamas we've also seenfor conveniencethe email package also provides subclasses of the message objecttailored to add message headers that provide the extra descriptive details used by email clients to know how to process the datafrom email mime text import mimetext text open('text txt'read( mimetext(textm['from''bob@bob comprint(mcontent-typetext/plaincharset="us-asciimime-version content-transfer-encoding bit frombob@bob com client-side scripting message subclass with headers payload is str text