admin管理员组

文章数量:1201804

Does anybody know of any JavaScript libraries that will read/parse a microsoft .msg file. I am writing a system that requires a viewer to dispay .msg files that have been stored on a server. I will probably also have to do .eml in the future too. I am not using framework or ASP. the project is HTML/CSS/Javascript+JQuery only.

I would need to extract only e-mail addresses for recipients / sender, subject, attachments (file names not the actual files), body (text & html), date sent etc.

Does anybody know of any JavaScript libraries that will read/parse a microsoft .msg file. I am writing a system that requires a viewer to dispay .msg files that have been stored on a server. I will probably also have to do .eml in the future too. I am not using .net framework or ASP. the project is HTML/CSS/Javascript+JQuery only.

I would need to extract only e-mail addresses for recipients / sender, subject, attachments (file names not the actual files), body (text & html), date sent etc.

Share Improve this question edited Oct 13, 2015 at 6:34 ROMANIA_engineer 56.6k30 gold badges208 silver badges205 bronze badges asked Mar 25, 2013 at 11:37 WongadobWongadob 1411 gold badge1 silver badge4 bronze badges 2
  • 1 Have you succeeded in writing a system that requires a viewer to dispay .msg files that have been stored on a server? If yes, would you like to share how you did it? – itsproject Commented Nov 4, 2014 at 9:24
  • If the requirement is not only javascript and you able to use Ruby or Python then you can use mapitool via github.com/aquasync/ruby-msg or stackoverflow.com/a/30445067/6163262 – whodini9 Commented Sep 28, 2020 at 20:13
Add a comment  | 

4 Answers 4

Reset to default 10

The msg.reader library seems to do the job.

You will need a MSG and/or EML converter library. I've used Mailbee.NET with success in the past, but Aspose or any other commercial library should work the same. Of course you could always code your own MSG parser by following the specifications, but wouldn't you rather be focused on your web solution?

Once you have the library - just wrap it up in a service facade and build AJAX requests in JS to retrieve the model data for display using your UI framework. You will need some server page handler for handling these dynamic AJAX requests - node.js, ASPX, JSP, PHP, etc.

As a side note - it would be very inefficient to pull down the entire MSG to the client just to retrieve part of the metadata. Consider an MSG with 50MB worth of attachments - if you only need the filenames - you're application will be useless/slow until it downloads all 50MB. I don't think the browser (or users) would like that.

I believe pure JS is not possible but with the help of node and linux on the server side we can.

It would be great if nodemailer and/or msg.reader library could support HTML emails in msg format though.

You can also use Redemption (I am its author) and its RDOSession.GetMessageFromMsgFile method. It is accessible in JavaScript (IE only), Java (through COM bridge) and any .Net language.

本文标签: jqueryParsing msg files in JavaScriptStack Overflow