本文介绍了使用 node js 读取 Outlook msg 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试读取从 Outlook 导出的 msg 文件.

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

有没有办法读取msg文件中的原始收件人用 nodejs?(我没有在线 office365,我说的是磁盘上的文件).

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).

作为一个罕见的例外,我找不到一个 npm 模块:-)

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

谢谢基督教

推荐答案

我发现这个库非常有用 - https://www.npmjs.com/package/@kenjiuno/msgreader

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

这篇关于使用 node js 读取 Outlook msg 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 04:27