if self askopen(appname'open text part "% "?basename)tryencoding textpartencoding(fullfilenametexteditor texteditormainpopup(parent=selfwintitle=% email part(encoding or '?')loadfirst=fullfilenameloadencode=encodingexceptshowerror(appname'error opening text viewer'multimedia typeswindows opens mediaplayerimagevieweretc elif maintype in ['image''audio''video']if self askopen(appname'open media part "% "?basename)trywebbrowser open_new('file://fullfilenameexceptshowerror(appname'error opening browser'common windows documentswordexceladobearchivesetc elif (sys platform[: ='winand maintype ='applicationand + types extension in [doc'docx'xls'xlsx'generalize me pdf'zip'tar'wmv'])if self askopen(appname'open part "% "?basename)os startfile(fullfilenameelsepuntmsg 'cannot open part"% "\nopen manually in"% "msg msg (basenameos path dirname(fullfilename)showinfo(appnamemsg##############################################################################message edit windows writereplyforward ##############################################################################if mailconfig smtpusermailsenderclass mailtools mailsenderauth elsemailsenderclass mailtools mailsender user set in mailconfiglogin/password required class writewindow(viewwindowmailsenderclass)""customize view display for composing new mail inherits sendmessage from mailtools mailsender ""modelabel 'writedef __init__(selfheadermapstarttext)viewwindow __init__(selfheadermapstarttextmailsenderclass __init__(selfself attaches [each win has own open dialog self opendialog none dialog remembers last dir pymailgui implementation