Extraction of msg attachment

120 views
Skip to first unread message

Enrico Donelli

unread,
Oct 25, 2012, 5:06:44 AM10/25/12
to java-libp...@googlegroups.com
Hi all, I need to extract the messages from a  PST (I think it's outllok 2003 format), but I have a problem with attachments: it seems that in case the attachment is a msg, only few bytes are extracted, nothing usable. No problem if the attachment is a .doc or an .xls file.

I'm doing something like:

int numberOfAttachments = email.getNumberOfAttachments();
for (int x = 0; x < numberOfAttachments; x++) {
     PSTAttachment attach = email.getAttachment(x);
     InputStream attachmentStream = attach.getFileInputStream();


     // save the stream in a file
}

Am I doing anything wrong?

Thanks in advance!
Enrico

kevin slote

unread,
Aug 7, 2013, 12:18:13 PM8/7/13
to java-libp...@googlegroups.com

I ran across a similar problem.  Try using attachment.getDisplayName(); .

For some reason .getFilename() and .getLongFilename() methods do not work for .msg files.
Reply all
Reply to author
Forward
0 new messages