content to vary. Isolating these configuration settings in this single module makes it
easy to configure the book’s email programs for a particular user, without having to
edit actual program logic code.
If you want to use any of this book’s email programs to do mail processing of your own,
be sure to change its assignments to reflect your servers, account usernames, and so on
(as shown, they refer to email accounts used for developing this book). Not all scripts
use all of these settings; we’ll revisit this module in later examples to explain more of
them.
Note that some ISPs may require that you be connected directly to their systems in
order to use their SMTP servers to send mail. For example, when connected directly
by dial-up in the past, I could use my ISP’s server directly, but when connected via
broadband, I had to route requests through a cable Internet provider. You may need
to adjust these settings to match your configuration; see your ISP to obtain the required
POP and SMTP servers. Also, some SMTP servers check domain name validity in ad-
dresses, and may require an authenticating login step—see the SMTP section later in
this chapter for interface details.
Example 13-17. PP4E\Internet\Email\mailconfig.py
"""
user configuration settings for various email programs (pymail/mailtools version);
email scripts get their server names and other email config options from this
module: change me to reflect your server names and mail preferences;
"""
#------------------------------------------------------------------------------
(required for load, delete: all) POP3 email server machine, user
#------------------------------------------------------------------------------
popservername = 'pop.secureserver.net'
popusername = '[email protected]'
#------------------------------------------------------------------------------
(required for send: all) SMTP email server machine name
see Python smtpd module for a SMTP server class to run locally;
#------------------------------------------------------------------------------
smtpservername = 'smtpout.secureserver.net'
#------------------------------------------------------------------------------
(optional: all) personal information used by clients to fill in mail if set;
signature -- can be a triple-quoted block, ignored if empty string;
address -- used for initial value of "From" field if not empty,
no longer tries to guess From for replies: this had varying success;
#------------------------------------------------------------------------------
myaddress = '[email protected]'
mysignature = ('Thanks,\n'
'--Mark Lutz (http://learning-python.com, http://rmi.net/~lutz)')'))
POP: Fetching Email | 903