in we built program called pymailgui that implements complete python+tkinter email client gui (if you didn' read that you may want to take quick glance at it nowherewe're going to do something of the samebut on the webthe system presented in this sectionpymailcgiis collection of cgi scripts that implement simple web-based interface for sending and reading email in any browser in effectit is webmail system--though not as powerful as what may be available from your internet service provider (isp)its scriptability gives you control over its operation and future evolution our goal in studying this system is partly to learn few more cgi trickspartly to learn bit about designing larger python systems in generaland partly to underscore the trade-offs between systems implemented for the web (the pymailcgi serverand systems written to run locally (the pymailgui clientthis hints at some of these trade-offs along the way and returns to explore them in more depth after the presentation of this system implementation overview at the top levelpymailcgi allows users to view incoming email with the post office protocol (popinterface and to send new mail by simple mail transfer protocol (smtpusers also have the option of replying toforwardingor deleting an incoming email while viewing it as implementedanyone can send email from pymailcgi sitebut to view your emailyou generally have to install pymailcgi on your own computer or web server accountwith your own mail server information (due to security concerns described laterviewing and sending email sounds simple enoughand we've already coded this few times in this book but the required interaction involves number of distinct web pageseach requiring cgi script or html file of its own in factpymailcgi is fairly linear system--in the most complex user interaction scenariothere are six states (and hence six web pagesfrom start to finish because each page is usually generated by distinct file in the cgi worldthat also implies six source files technicallypymailcgi could also be described as state machinethough very little state is transferred from state to state scripts pass user and message information to the next script in hidden form fields and query parametersbut there are no client-side cookies or server-side databases in the current version stillalong the way we'll encounter situations where more advanced state retention tools could be an advantage to help keep track of how all of pymailcgi' source files fit into the overall systemi jotted down the file in example - before starting any real programming it informally sketches the user' flow through the system and the files invoked along the way you can certainly use more formal notations to describe the flow of control and information the pymailcgi server