Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How do i read and extract information from Outllook .MSG file

843834Dec 17 2009 — edited Dec 18 2009
Hi,

I have a .msg file saved on my local drive. I want to read the file and extract information such as "sender", "to", "CC", "BCC", date sent / received and subject.

I'm using POI-HSMF which seems to be perfect for the task, but it's not returning exactly what i want. Below is the code i'm using to test:

MAPIMessage msg = new MAPIMessage("c:\\Emailing_22-11-2009.msg");
System.out.println("From :" + msg.getDisplayFrom());
System.out.println("TO :" + msg.getDisplayTo());
System.out.println("CC :" + msg.getDisplayCC());
System.out.println("BCC :" + msg.getDisplayBCC());
System.out.println("Subject :" + msg.getSubject());

The results returned are the names assigned to email addresses, not the actual email address. For example : 'Peter Bloom' instead of pbloom@forums.com

How do i get the actual email address or is there another library in which i can use to achieve the same results?

The msgparser library is kind of limited because i cannot read addresses on CC, and BCC.

Please help,

Thank,
LM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 15 2010
Added on Dec 17 2009
4 comments
972 views