Bcc addresses added to envelope but header omitted
Minor change: addresses entered in the user-selectable Bcc header line of edit win-
dows are included in the recipients list (the “envelope”), but the Bcc header line
itself is no longer included in the message text sent. Otherwise, Bcc recipients might
be seen by some email readers and clients (including PyMailGUI), which defeats
most of this header’s purpose.
Avoiding parallel fetches of the same mail
PyMailGUI loads only mail headers initially, and fetches a mail’s full text later when
needed for viewing and other operations, allowing multiple fetches to overlap in
time (they are run in parallel threads). Though unlikely, it was not impossible for
a user to trigger a new fetch for a mail that was currently being fetched, by selecting
the mail again during its download (clicking its list entry twice quickly sufficed to
kick this off). Although the message cache updates performed in the parallel fetch
threads appeared to be thread safe, this behavior seemed odd and wasted time.
To do better, this version now keeps track of all fetches in progress in the main
thread, to avoid this overlap potential entirely—a message fetch in progress disa-
bles all new fetch requests that it is a part of, until its fetch completes. Multiple
overlapping fetches are still allowed, as long as their targets do not intersect. A set
is used to detect nondisjoint fetch requests. Mails already fetched and cached are
not subject to this check and can always be selected irrespective of any fetches in
progress.
Multiple recipients separated in GUI by commas, not semicolons
In the prior edition, “;” was used as the recipient character, and addresses were
naively split on “;” on a send. This attempted to avoid conflicts with “,” commonly
used in email names. Replies dropped the name part if it contained a “;” when
extracting a To address, but it was not impossible that clashes could still arise if a
“;” appeared both as the separator and in manually typed address’s name.
To improve, this edition uses “,” as the recipient separator, and fully parses email
address lists with the email package’s getaddresses and parseaddr tools, instead of
splitting naively. Because these tools fully parse the list’s content, “,” characters
embedded in email address name parts are not mistakenly takes as address sepa-
rators, and so do not clash. Servers and clients generally expect “,” separators, too,
so this works naturally.
With this fix, commas can appear both as address separators as well as embedded
in address name components. For replies, this is handled automatically: the To
field is prefilled with the From in the original message. For sends, the split happens
automatically in email tools for To, Cc, and Bcc headers fields (the latter two are
ignored if they contain just the initial “?” when sent).
HTML help display
Help can now be displayed in text form in a GUI window, in HTML form in a
locally running web browser, or both. User settings in the mailconfig module select
which form or forms to display. The HTML version is new; it uses a simple
1014 | Chapter 14: The PyMailGUI Client