but the view window superclass of edit windows performs decoding
on all displayed headers (the extra Subject decode is a no-op);
on sends, all non-ASCII hdrs and hdr email names are in decoded
form in the GUI, but are encoded within the mailtools package;
quoteOrigText also decodes the initial headers it inserts into
the quoted text block, and index lists decode for display;
"""
for msgnum in msgnums:
fulltext = self.getMessage(msgnum)
message = self.parseMessage(fulltext) # may fail: error obj
maintext = self.formatQuotedMainText(message) # same as forward
from and to are decoded by view window
From = mailconfig.myaddress # not original To
To = message.get('From', '') # 3.0: ',' sept
Cc = self.replyCopyTo(message) # 3.0: cc all recipients?
Subj = message.get('Subject', '(no subject)')
Subj = self.decodeHeader(Subj) # deocde for str
if Subj[:4].lower() != 're: ': # 3.0: unify case
Subj = 'Re: ' + Subj
ReplyWindow(starttext = maintext,
headermap =
dict(From=From, To=To, Cc=Cc, Subject=Subj, Bcc=From))
def onFwdMail(self):
possibly threaded: forward selected emails
msgnums = self.verifySelectedMsgs()
if msgnums:
self.getMessages(msgnums, after=lambda: self.contFwd(msgnums))
def contFwd(self, msgnums):
"""
finish Forward: drop attachments, quote with '>', add signature;
see notes about headers decoding in the Reply action methods;
view window superclass will decode the From header we pass here;
"""
for msgnum in msgnums:
fulltext = self.getMessage(msgnum)
message = self.parseMessage(fulltext)
maintext = self.formatQuotedMainText(message) # same as reply
initial From value from config, not mail
From = mailconfig.myaddress # encoded or not
Subj = message.get('Subject', '(no subject)')
Subj = self.decodeHeader(Subj) # 3.0: send encodes
if Subj[:5].lower() != 'fwd: ': # 3.0: unify case
Subj = 'Fwd: ' + Subj
ForwardWindow(starttext = maintext,
headermap = dict(From=From, Subject=Subj, Bcc=From))
def onSaveMailFile(self):
"""
save selected emails to file for offline viewing;
disabled if target file load/delete is in progress;
disabled by getMessages if self is a busy file too;
PyMailGUI Implementation| 1073