read outlook msg files with node js

孤街浪徒 提交于 2021-01-27 14:01:43

问题


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


回答1:


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;
}



来源:https://stackoverflow.com/questions/47246944/read-outlook-msg-files-with-node-js

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