CHAPTER 14
The PyMailGUI Client
“Use the Source, Luke”
The preceding chapter introduced Python’s client-side Internet protocols tool set—the
standard library modules available for email, FTP, network news, HTTP, and more,
from within a Python script. This chapter picks up where the last one left off and
presents a complete client-side example—PyMailGUI, a Python program that sends,
receives, composes, and parses Internet email messages.
Although the end result is a working program that you can actually use for your email,
this chapter also has a few additional agendas worth noting before we get started:
Client-side scripting
PyMailGUI implements a full-featured desktop GUI that runs on your machine
and communicates with your mail servers when necessary. As such, it is a network
client program that further illustrates some of the preceding chapter’s topics, and
it will help us contrast server-side solutions introduced in the next chapter.
Code reuse
Additionally, PyMailGUI ties together a number of the utility modules we’ve been
writing in the book so far, and it demonstrates the power of code reuse in the
process—it uses a thread module to allow mail transfers to overlap in time, a set
of mail modules to process message content and route it across networks, a window
protocol module to handle icons, a text editor component, and so on. Moreover,
it inherits the power of tools in the Python standard library, such as the email
package; message construction and parsing, for example, is nearly trivial here.
Programming in the large
And finally, this chapter serves to illustrate realistic and large-scale software de-
velopment in action. Because PyMailGUI is a relatively large and complete pro-
gram, it shows by example some of the code structuring techniques that prove
useful once we leave the realm of the small and artificial. For instance, object-
oriented programming and modular design work well here to divide the system in
smaller, self-contained units.
1005
Do
wnload from Wow! eBook <www.wowebook.com>