问题
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