' cut down treesi skip and jump, ' like to press wild flowers 'as we'll see laterwe'll need to decode similarly in order to parse this text with email tools the next section exposes the bytes-based interface as well fetching email at the interactive prompt if you don' mind typing code and reading pop server messagesit' possible to use the python interactive prompt as simple email clienttoo the following session uses two additional interfaces we'll apply in later examplesconn list(returns list of "message-number message-sizestrings conn topn retrieves just the header text portion of message number the top call also returns tuple that includes the list of line strings sent backits second argument tells the server how many additional lines after the headers to sendif any if all you need are header detailstop can be much quicker than the full text fetch of retrprovided your mail server implements the top command (most do) :\pp \internet\emailpython from poplib import pop conn pop ('pop secureserver net'conn user('pp @learning-python com' '+ok conn pass_('xxxxxxxx' '+ok connect to server log in to account conn stat(num mailsnum bytes ( conn list(( '+ok '[ ' ' ' '] conn top( ( '+ok octets '[ 'received(qmail invoked from network) may lines omitted ' -originating-ip ' ' -nonspamnone' '' ''] conn retr( ( '+ok octets '[ 'received(qmail invoked from network) may lines omitted ' -originating-ip ' ' -nonspamnone' '' ' cut down treesi skip and jump,' ' like to press wild flowers ' '' ''] conn quit( '+ok popfetching email