Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

read outlook msg files with node js

I'm trying to read msg-files that are exported from outlook.

Is there a way of reading the original recipient in the msg-file with nodejs? (I don't have online office365, I'm talking about files on disk).

As a rare exception, I couldn't find a npm module for this :-)

Thanks Christian

like image 939
Chris Avatar asked Oct 26 '25 05:10

Chris


1 Answers

I found this library to be very useful - https://www.npmjs.com/package/@kenjiuno/msgreader

Ideally, you'd be doing something like this:

import MsgReader from '@kenjiuno/msgreader';
import * as fs from 'fs'

readMail = () => { 
var readFileAsBuffer = fs.readFileSync('fileLocationHere');
var msgReader = new MSGReader(readFileAsBuffer );
var fileData = msgReader.getFileData();
//FileData will have body, subject etc
var getBody = fileData.body;
}

like image 158
bobcatBisto Avatar answered Oct 28 '25 20:10

bobcatBisto



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!