Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parsing .msg files in JavaScript

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.

like image 615
Wongadob Avatar asked Mar 25 '13 11:03

Wongadob


3 Answers

The msg.reader library seems to do the job.

like image 107
Markus Peröbner Avatar answered Nov 07 '22 06:11

Markus Peröbner


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.

like image 44
SliverNinja - MSFT Avatar answered Nov 07 '22 06:11

SliverNinja - MSFT


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.

like image 2
Nestor Urquiza Avatar answered Nov 07 '22 07:11

Nestor Urquiza