Luckily, all of this is much easier than it may sound. Python’s standard email module
extracts all of the original message’s header lines, and a single string replace method
call does the work of adding the > quotes to the original message body. I simply type
what I wish to say in reply (the initial paragraph in the mail’s text area) and press the
Send button to route the reply message to the mailbox on my mail server again. Phys-
ically sending the reply works the same as sending a brand-new message—the mail is
routed to your SMTP server in a spawned send-mail thread, and the send-mail wait
pop up appears while the thread runs.
Forwarding a message is similar to replying: select the message in the main window,
press the Fwd button, and fill in the fields and text area of the popped-up composition
window. Figure 14-30 shows the window created to forward the mail we originally
wrote and received after a bit of editing.
Figure 14-30. PyMailGUI forward compose window
Much like replies, forwards fill From with the sender’s address in mailconfig; the orig-
inal text is automatically quoted in the message body again; Bcc is preset initially the
same as From; and the subject line is preset to the original message’s subject prepended
with the string “Fwd:”. All these lines can be changed manually before sending if you
wish to tailor. I always have to fill in the To line manually, though, because a forward
is not a direct reply—it doesn’t necessarily go back to the original sender. Further, the
1046 | Chapter 14: The PyMailGUI Client