[Python编程(第4版)].(Programming.Python.4th.Edition).Mark.Lutz.文字版

(yzsuai) #1

pswd to name of a file holding your SMTP password, or an empty string to


force programs to ask (in a console, or GUI)


#-------------------------------------------------------------------------------


smtpuser = None # per your ISP
smtppasswdfile = '' # set to '' to be asked


#smtpuser = popusername


#-------------------------------------------------------------------------------


(optional) PyMailGUI: name of local one-line text file with your POP


password; if empty or file cannot be read, pswd is requested when first


connecting; pswd not encrypted: leave this empty on shared machines;


PyMailCGI always asks for pswd (runs on a possibly remote server);


#-------------------------------------------------------------------------------


poppasswdfile = r'c:\temp\pymailgui.txt' # set to '' to be asked


#-------------------------------------------------------------------------------


(required) local file where sent messages are always saved;


PyMailGUI 'Open' button allows this file to be opened and viewed;


don't use '.' form if may be run from another dir: e.g., pp4e demos


#-------------------------------------------------------------------------------


#sentmailfile = r'.\sentmail.txt' #. means in current working dir


#sourcedir = r'C:...\PP4E\Internet\Email\PyMailGui\'
#sentmailfile = sourcedir + 'sentmail.txt'


determine automatically from one of my source files


import wraplines, os
mysourcedir = os.path.dirname(os.path.abspath(wraplines.file))
sentmailfile = os.path.join(mysourcedir, 'sentmail.txt')


#-------------------------------------------------------------------------------


(defunct) local file where pymail saves POP mail (full text);


PyMailGUI instead asks for a name in GUI with a pop-up dialog;


Also asks for Split directory, and part buttons save in ./TempParts;


#-------------------------------------------------------------------------------


#savemailfile = r'c:\temp\savemail.txt' # not used in PyMailGUI: dialog


#-------------------------------------------------------------------------------


(optional) customize headers displayed in PyMailGUI list and view windows;


listheaders replaces default, viewheaders extends it; both must be tuple of


strings, or None to use default hdrs;


#-------------------------------------------------------------------------------


listheaders = ('Subject', 'From', 'Date', 'To', 'X-Mailer')
viewheaders = ('Bcc',)


#-------------------------------------------------------------------------------


(optional) PyMailGUI fonts and colors for text server/file message list


windows, message content view windows, and view window attachment buttons;


use ('family', size, 'style') for font; 'colorname' or hexstr '#RRGGBB' for


PyMailGUI Implementation| 1107
Free download pdf