print(fetcher downloadmessage(num+ rstrip()'\ ''-'* last len(hdrs)- msgssizesloadedall fetcher downloadallmessages(statusloadfrom=last for msg in msgsprint(msg[: ]'\ ''-'* parser mailparser(for in [ ]try [ len(msgs)fulltext msgs[imessage parser parsemessage(fulltextctypemaintext parser findmaintext(messageprint('parsed:'message['subject']print(maintextinput('press enter to exit'pause if clicked on windows running the self-test here' run of the self-test scriptit generates lot of outputmost of which has been deleted here for presentation in this book--as usualrun this on your own for further detailsc:\pp \internet\email\mailtoolsselftest py config\mailconfig py userpp @learning-python com adding text/ -python sending to ['pp @learning-python com'content-typemultipart/mixedboundary="=============== ==mime-version frompp @learning-python com topp @learning-python com subjecttesting mailtools package datesat may : : - -mailermailtools multi-part mime format message --=============== =content-typetext/plaincharset="us-asciimime-version content-transfer-encoding bit here is my source code --=============== =content-typetext/ -pythoncharset="us-asciimime-version content-transfer-encoding bit content-dispositionattachmentfilename="selftest py""##############################################################################self-test when this file is run as program ############################################################################## client-side scripting