lines of code to customize it. Want to save and delete your mail automatically as
it is loaded? Add some more code and buttons. Tired of seeing junk mail? Add a
few lines of text processing code to the load function to filter spam. These are just
a few examples. The point is that because PyMailGUI is written in a high-level,
easy-to-maintain scripting language, such customizations are relatively simple, and
might even be fun.
At the end of the day, because of such features, this is a realistic Python program that
I actually use—both as a primary email tool and as a fallback option when my ISP’s
webmail system goes down (which, as I mentioned in the prior chapter, has a way of
happening at the worst possible times).† Python scripting is an enabling skill to have.
Running PyMailGUI
Of course, to script PyMailGUI on your own, you’ll need to be able to run it. PyMailGUI
requires only a computer with some sort of Internet connectivity (a PC with a broad-
band or dial-up account will do) and an installed Python with the tkinter extension
enabled. The Windows port of Python has this capability, so Windows PC users should
be able to run this program immediately by clicking its icon.
Two notes on running the system: first, you’ll want to change the file mailconfig.py in
the program’s source directory to reflect your account’s parameters, if you wish to send
or receive mail from a live server; more on this as we interact with the system ahead.
Second, you can still experiment with the system without a live Internet connection—
for a quick look at message view windows, use the main window’s Open buttons to
open saved-mail files included in the program’s SavedMail subdirectory. The PyDemos
launcher script at the top of the book’s examples directory, for example, forces Py-
MailGUI to open saved-mail files by passing filenames on the command line. Although
you’ll probably want to connect to your email servers eventually, viewing saved mails
offline is enough to sample the system’s flavor and does not require any configuration
file changes.
Presentation Strategy
PyMailGUI is easily the largest program in this book, but it doesn’t introduce many
library interfaces that we haven’t already seen in this book. For instance:
- The PyMailGUI interface is built with Python’s tkinter, using the familiar listboxes,
buttons, and text widgets we met earlier. - Python’s email package is applied to pull-out headers, text, and attachments of
messages, and to compose the same.
† In fact, my ISP’s webmail send system went down the very day I had to submit the third edition of this book
to my publisher! No worries—I fired up PyMailGUI and used it to send the book as attachment files through
a different server. In a sense, this book submitted itself.
1010 | Chapter 14: The PyMailGUI Client