Parsing .msg files in JavaScript
Asked Answered
F

4

13

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.

Forgiven answered 25/3, 2013 at 11:37 Comment(2)
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?Bill
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 https://mcmap.net/q/335438/-parsing-outlook-msg-files-with-pythonCerellia
H
10

The msg.reader library seems to do the job.

Hedwighedwiga answered 21/7, 2017 at 5:40 Comment(0)
T
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.

Telegraphese answered 25/3, 2013 at 13:49 Comment(0)
V
2

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.

Vacuva answered 5/11, 2017 at 19:48 Comment(0)
P
1

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.

Programme answered 25/3, 2013 at 17:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.