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

(yzsuai) #1

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


(required, for fetch) the Unicode encoding used to decode fetched full message


bytes, and to encode and decode message text stored in text-mode save files; see


the book's Chapter 13 for details: this is a limited and temporary approach to


Unicode encodings until a new bytes-friendly email package parser is provided


which can handle Unicode encodings more accurately on a message-level basis;


note: 'latin1' (an 8-bit encoding which is a superset of 7-bit ascii) was


required to decode message in some old email save files I had, not 'utf8';


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


fetchEncoding = 'latin-1' # how to decode and store full message text (ascii?)


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


(optional, for send) Unicode encodings for composed mail's main text plus all


text attachments; set these to None to be prompted for encodings on mail send,


else uses values here across entire session; default='latin-1' if GUI Cancel;


in all cases, falls back on UTF-8 if your encoding setting or input does not


work for the text being sent (e.g., ascii chosen for reply to non-ascii text,


or non-ascii attachments); the email package is pickier than Python about


names: latin-1 is known (uses qp MIME), but latin1 isn't (uses base64 MIME);


set these to sys.getdefaultencoding() result to choose the platform default;


encodings of text parts of fetched email are automatic via message headers;


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


mainTextEncoding = 'ascii' # main mail body text part sent (None=ask)
attachmentTextEncoding = 'ascii' # all text part attachments sent (utf-8, latin-1)


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


(optional, for send) set this to a Unicode encoding name to be applied to


non-ASCII headers, as well as non-ASCII names in email addresses in headers,


in composed messages when they are sent; None means use the UTF-8 default,


which should work for most use cases; email names that fail to decode are


dropped (the address part is used); note that header decoding is performed


automatically for display, according to header content, not user setting;


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


headersEncodeTo = None # how to encode non-ASCII headers sent (None=UTF-8)


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


(optional) select text, HTML, or both versions of the help document;


always shows one or the other: displays HTML if both of these are turned off


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


showHelpAsText = True # scrolled text, with button for opening source files
showHelpAsHTML = True # HTML in a web browser, without source file links


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


(optional) if True, don't show a selected HTML text message part in a PyEdit


popup too if it is being displayed in a web browser; if False show both, to


see Unicode encoding name and effect in a text widget (browser may not know);


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


skipTextOnHtmlPart = False # don't show html part in PyEdit popup too


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


PyMailGUI Implementation| 1109
Free download pdf