in your inbox (and as confessed in have thousands in one of minea better solution would somehow cache mails to limit reloadsat least for the duration of browser session for examplewe might load headers of only newly arrived messagesand cache headers of mails already fetchedas done in the pymailgui client of due to the lack of state retention in cgi scriptsthoughthis would likely require some sort of server-side database we mightfor instancestore already fetched message headers under generated key that identifies the session ( with process number and timeand pass that key between pages as cookiehidden form fieldor url query parameter each page would use the key to fetch cached mail stored directly on the web serverinstead of loading it from the email server again presumablyloading from local cache file would be faster than loading from network connection to the mail server this would make for an interesting exercisetooif you wish to extend this system on your ownbut it would also result in more pages than this has to spend (franklyi ran out of time for this project and real estate in this long before ran out of potential enhancementspresentation overview much of the "actionin pymailcgi is encapsulated in shared utility modulesespecially one called commonhtml py as you'll see in momentthe cgi scripts that implement user interaction don' do much by themselves because of this this architecture was chosen deliberatelyto make scripts simpleavoid code redundancyand implement common look-and-feel in shared code but it means you must jump between files to understand how the whole system works to make this example easier to digestwe're going to explore its code in two chunkspage scripts firstand then the utility modules firstwe'll study screenshots of the major web pages served up by the system and the html files and top-level python cgi scripts used to generate them we begin by following send mail interactionand then trace how existing email is read and then processed most implementation details will be presented in these sectionsbut be sure to flip ahead to the utility modules listed later to understand what the scripts are really doing should also point out that this is fairly complex systemand won' describe it in exhaustive detailas for pymailgui and be sure to read the source code along the way for details not made explicit in the narrative all of the system' source code appears in this as well as in the book' examples distribution packageand we will study its key concepts here but as usual with case studies in this booki assume that you can read python code by now and that you will consult the example' source code for more details because python' syntax is so close to "executable the pymailcgi server