用 Java 读取 Outlook .msg 文件的最佳库是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/65936/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 10:55:00  来源:igfitidea点击:

What's the best library for reading Outlook .msg files in Java?

javaoutlookmsg

提问by muriloq

I would like to read the text and binary attachments in a saved Outlook message (.msg file) from a Java application, without resorting to native code (JNI, Java Native Interface).

我想从 Java 应用程序读取保存的 Outlook 消息(.msg 文件)中的文本和二进制附件,而不使用本机代码(JNI,Java 本机接口)。

Apache POI-HSMFseems to be in the right direction, but it's in very early stages of development...

Apache POI-HSMF似乎朝着正确的方向发展,但它仍处于开发的早期阶段……

采纳答案by Alan Krueger

  • You could use Apache POIFS, which seems to be a little more mature, but that would appear to duplicate the efforts of POI-HSMF.

  • You could use POI-HSMF and contribute changes to get the features you need working. That's often how FOSS projects like that expand.

  • You could use com4j, j-Interop, or some other COM-level interop feature and interact directly with the COM interfaces that provide access to the structured document. That would be much easier than trying to hit it directly through JNI.

  • 您可以使用 Apache POIFS,它似乎更成熟一些,但这似乎重复了 POI-HSMF 的工作。

  • 您可以使用 POI-HSMF 并进行更改以获得所需的功能。像这样的 FOSS 项目通常就是这样扩展的。

  • 您可以使用 com4j、j-Interop 或其他一些 COM 级别的互操作功能,并直接与提供对结构化文档的访问的 COM 接口交互。这比尝试通过 JNI 直接命中要容易得多。

回答by RealHowTo

msgparseris a small open source Java library that parses Outlook .msg files and provides their content using Java objects. msgparser uses the Apache POI - POIFSlibrary to parse the message files which use the OLE 2 Compound Document format.

msgparser是一个小型开源 Java 库,用于解析 Outlook .msg 文件并使用 Java 对象提供其内容。msgparser 使用Apache POI - POIFS库来解析使用 OLE 2 复合文档格式的消息文件。

回答by Vasco Duarte

Have you tried to use Jython with the Python win32 extensions (http://www.jython.org/Project/+ http://python.net/crew/mhammond/win32/)? If this is for a "personal" or "internal" project Jython with Python may be a very good choice. If you are building a "shrink wrapped" software package this may not be the best option.

您是否尝试过将 Jython 与 Python win32 扩展(http://www.jython.org/Project/+ http://python.net/crew/mhammond/win32/)一起使用?如果这是用于“个人”或“内部”项目,Jython with Python 可能是一个非常好的选择。如果您正在构建“收缩包装”软件包,这可能不是最佳选择。

回答by Harshit