"" euse comma separator for multiple addrs in the uiand getaddresses to split correctly and allow for comma in the name parts of addressesused by pymailgui to split toccbcc as needed for user inputs and copied headersreturns empty list if field is emptyor any exception occurs""trypairs email utils getaddresses([field][(name,addr)return [email utils formataddr(pairfor pair in pairs[name exceptreturn 'syntax error in user-entered field?etc returned when parses fail errormessage message(errormessage set_payload('[unable to parse message format error]'def parseheaders(selfmailtext)""parse headers onlyreturn root email message message object stops after headers parsedeven if nothing else follows (topemail message message object is mapping for mail header fields payload of message object is nonenot raw body text ""tryreturn email parser parser(parsestr(mailtextheadersonly=trueexceptreturn self errormessage def parsemessage(selffulltext)""parse entire messagereturn root email message message object payload of message object is string if not is_multipart(payload of message object is more messages if multiple parts the call here same as calling email message_from_string(""tryreturn email parser parser(parsestr(fulltextmay failexceptreturn self errormessage or let call handlecan check return def parsemessageraw(selffulltext)""parse headers onlyreturn root email message message object stops after headers parsedfor efficiency (not yet used herepayload of message object is raw text of mail after headers ""tryreturn email parser headerparser(parsestr(fulltextexceptreturn self errormessage client-side scripting