Now, let’s go back to the PyMailGUI main server list window, and click the Load button to retrieve incoming email over the POP protocol. PyMailGUI’s load function gets account parameters from the mailconfig module listed later in this chapter,
Figure 15-5.PyMailGUI attached PyEdit info box
so be sure to change this file to reflect your email account parameters (i.e., server names and usernames) if you wish to use PyMailGUI to read your own email.
The account password parameter merits a few extra words. In PyMailGUI, it may come from one of two places:
Local file If you put the name of a local file containing the password in themailconfigmodule, PyMailGUI loads the password from that file as needed.
Popup dialog If you don’t put a password filename inmailconfig (or if PyMailGUI can’t load it from the file for whatever reason), PyMailGUI will instead ask you for your password anytime it is needed.
Figure 15-6 shows the password input prompt you get if you haven’t stored your password in a local file. Note that the password you type is not shown—ashow='*'option for theEntryfield used in this popup tells Tkinter to echo typed characters as stars (this option is similar in spirit to both thegetpassconsole input module we met earlier in the prior chapter, and an HTMLtype=passwordoption we’ll meet in a later chapter). Once entered, the password lives only in memory on your machine; PyMailGUI itself doesn’t store it anywhere in a permanent way.
Also notice that the local file password option requires you to store your password unencrypted in a file on the local client computer. This is convenient (you don’t need to retype a password every time you check email), but it is not generally a good idea on a machine you share with others; leave this setting blank inmailconfigif you prefer to always enter your password in a popup.
Once PyMailGUI fetches your mail parameters and somehow obtains your password, it will next attempt to pull down the header text of all your incoming email from your inbox on your POP email server. On subsequent loads, only newly arrived mails are loaded, if any.
Figure 15-6. PyMailGUI password input dialog
To save time, PyMailGUI fetches message header text only to populate the list window. The full text of messages is fetched later only when a message is selected for viewing or processing, and then only if the full text has not yet been fetched during this session. PyMailGUI reuses the load-mail tools in themailtools module of Chapter 14 to fetch message header text, which in turn uses Python’s standardpoplibmodule to retrieve your email.