if type ='text/html'if ((not mailconfig verifyhtmltextopenor askyesno(appname'open message text in browser?')) get post mime decodepre unicode decode bytes typeasbytes self findmaintext(messageasstr=falsetryfrom tempfile import gettempdir or tk html viewertempname os path join(gettempdir()'pymailgui html'tmp open(tempname'wb'already encoded tmp write(asbyteswebbrowser open_new('file://tempnameexceptshowerror(appname'cannot open in browser'def onwritemail(self)""compose new email from scratchwithout fetching othersnothing to quote herebut adds sigand prefills bcc with the sender' address if this optional header enabled in mailconfigfrom may be encoded in mailconfigview window will decode""starttext '\nuse auto signature text if mailconfig mysignaturestarttext +'% \nmailconfig mysignature from mailconfig myaddress writewindow(starttext starttextheadermap dict(from=frombcc=from) prefill bcc def onreplymail(self)possibly threadedreply to selected emails msgnums self verifyselectedmsgs(if msgnumsself getmessages(msgnumsafter=lambdaself contreply(msgnums)def contreply(selfmsgnums)""finish replydrop attachmentsquote with '>'add signaturepresets initial to/from values from mail or config moduledon' use original to for frommay be many or listnameto keeps nameformat even if ',separator in nameuses original from for toignores reply-to header is any replies also copy to all original recipients by default now uses getaddresses/parseaddr full parsing to separate addrs on commasand handle any commas that appear nested in email name partsmultiple addresses are separated by comma in guiwe copy comma separators when displaying headersand we use getaddresses to split addrs as needed',is required by servers for separatorno longer uses parseaddr to get st name/addr pair of getaddresses resultuse full from for to we decode the subject header here because we need its text the pymailgui client