Parsing .msg files in JavaScript

限于喜欢 提交于 2019-12-08 15:47:23

问题


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.


回答1:


The msg.reader library seems to do the job.




回答2:


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.




回答3:


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




回答4:


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.



来源:https://stackoverflow.com/questions/15613957/parsing-msg-files-in-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!