What's the best library for reading Outlook .msg files in Java? [closed]
Asked Answered
D

4

6

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

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

Diverse answered 15/9, 2008 at 19:25 Comment(1)
#14869941Lesleelesley
W
3
  • 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.

Wishbone answered 15/9, 2008 at 19:36 Comment(0)
S
7

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

Sorbian answered 22/7, 2010 at 4:10 Comment(1)
Simple Java Mail uses a fork of msgparser (Outlook Message Parser) and has API for directly reading Outlook messages to MimeMessage, Email or EML.Sparklesparkler
W
3
  • 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.

Wishbone answered 15/9, 2008 at 19:36 Comment(0)
T
-1

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.

Terramycin answered 15/9, 2008 at 19:36 Comment(1)
I really like Python / Jython, but I'm afraid in this case I won't be able to use it (exactly because it's not a personal / internal / toy project).Diverse
R
-1

Apache POI-HSMF.

You can start from the example given in below link. http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/examples/src/org/apache/poi/hsmf/examples/Msg2txt.java?revision=821500&view=markup&pathrev=821500

Further read library docs.

Roadway answered 17/6, 2015 at 20:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.