ColdFusion: Extract information from a .msg file -
i make application user drags in .msg file web app. coldfusion extract following fields: name, sender email, subject, etc. , pre-populate in form ready submitted. have googled "read .msg coldfusion" can't seem find information. when fileread()
see gibberish ÐÏࡱá > þÿ
because it's encrypted. possible? hope can point me in right direction. open trying different approach.
as @imthepitts mentioned, file not encrypted, in binary. however, not enough load bytes filereadbinary()
. need tool understands format of .msg files , can parse contents.
if quick search, there bunch of tools capable of parsing .msg files (most java or .net). 1 such tool poi's hsmf (horrible stupid mail format). built cf. may want start there.
here quick , dirty example translated hsmf examples:
<cfscript> pathtofile = "c:/path/to/somemessage.msg"; mapimessage = createobject("java", "org.apache.poi.hsmf.mapimessage"); message = mapimessage.init(pathtofile); try { writeoutput("from: "& message.getdisplayfrom() &"<hr>"); writeoutput("to: "& message.getdisplayto() &"<hr>"); writeoutput("cc: "& message.getdisplaycc() &"<hr>"); writeoutput("bcc: "& message.getdisplaybcc() &"<hr>"); writeoutput("subject: "& message.getsubject() &"<hr>"); writeoutput("body: "& message.gettextbody() &"<hr>"); } catch (org.apache.poi.hsmf.exceptions.chunknotfoundexception e) { writedump(e); } </cfscript>
Comments
Post a Comment