import mimify import sys mimify.unmimify("samples/sample.msg", sys.stdout, 1)
import mimify import StringIO, sys # # decode message into a string buffer file = StringIO.StringIO() mimify.unmimify("samples/sample.msg", file, 1) # # encode message from string buffer file.seek(0) # rewind mimify.mimify(file, sys.stdout)
import mimify mimify.unmimify("thismsg_enc.txt","thismsg_dec.txt",decode_base64=1) fileh = open('thismsg_dec.txt','r') msgContent =fileh.read() msgContent = str.replace(msgContent,'<div','__div__<div') msgPart = str.split(msgContent,'__div__',4) import APsummary import APtext import slugTools summary = APsummary.getSummaryFields(msgPart[3]) # get the four-digit profile ID profileId = slugTools.getProfile(summary['apcategory'],summary['dateline']) # get elements for slug: date, trans ref, emailers' initials. # also get a date formatted for the pubdate field. staffHandle = slugTools.getStaffHandle(msgPart[0]) pubDate = slugTools.dateString() slugDate = slugTools.slugDateString() transNum = slugTools.firstToken(summary['filenametransref']) # combine the slug elements to appear in the slug field. # prepend the path and append '.xml' for the physical filename.
import mimify import io, sys # # decode message into a string buffer file = io.StringIO() mimify.unmimify("samples/sample.msg", file, 1) # # encode message from string buffer file.seek(0) # rewind mimify.mimify(file, sys.stdout)