as final email example in this and to give better use case for the mail tools module package of the preceding sectionsexample - provides an updated version of the pymail program we met earlier (example - it uses our mailtools package to access emailinstead of interfacing with python' email package directly compare its code to the original pymail in this to see how mailtools is employed here you'll find that its mail download and send logic is substantially simpler example - pp \internet\email\pymail py #!/usr/local/bin/python ""###############################################################################pymail simple console email interface client in pythonthis version uses the mailtools packagewhich in turn uses poplibsmtpliband the email package for parsing and composing emailsdisplays first text part of mailsnot the entire full textfetches just mail headers initiallyusing the top commandfetches full text of just email selected to be displayedcaches already fetched mailscaveatno way to refresh indexuses standalone mailtools objects they can also be used as superclasses###############################################################################""import mailconfigmailtools from pymail import inputmessage mailcache {def fetchmessage( )tryfulltext mailcache[iexcept keyerrorfulltext fetcher downloadmessage(imailcache[ifulltext return fulltext def sendmessage()fromtosubjtext inputmessage(sender sendmessage(fromtosubj[]textattaches=nonedef deletemessages(todeleteverify=true)print('to be deleted:'todeleteif verify and input('delete?')[: not in [' '' ']print('delete cancelled 'elseprint('deleting messages from server 'fetcher deletemessages(todeletedef showindex(msglistmsgsizeschunk= )count for (msgsizein zip(msglistmsgsizes)email message messageint count + iter ok here print('% :\ % bytes(countsize)for hdr in ('from''to''date''subject') client-side scripting