Javamail with TNEF parts

S

sefner

Hello all,

I am trying to use the Javamail API to extract messages from an
Exchange server using the IMAP protocol. Everything so far has worked
fine as long as the Multipart messages don't contain a TNEF part. I
have found JTNEF to parse these parts and extract the attachments but
the problem is when using Javamail I don't see the TNEF part:

Message message = folder.getMessage(1);
assertEquals("checking number of parts", 2,
((Multipart)message.getContent()).getCount());

For instance, the above test fails saying it expected 2 parts but found
1. I'm sure I am getting the correct message and that there is a TNEF
part because:

message.writeTo(System.out)

shows it. Printing out the content of the part I can actually get at
prints the body of the email but this is all I can get. Any
suggestions on what I am missing here?

Thanks for your time!
 
A

Ann

Hello all,

I am trying to use the Javamail API to extract messages from an
Exchange server using the IMAP protocol. Everything so far has worked
fine as long as the Multipart messages don't contain a TNEF part. I
have found JTNEF to parse these parts and extract the attachments but
the problem is when using Javamail I don't see the TNEF part:

Message message = folder.getMessage(1);
assertEquals("checking number of parts", 2,
((Multipart)message.getContent()).getCount());

For instance, the above test fails saying it expected 2 parts but found
1. I'm sure I am getting the correct message and that there is a TNEF
part because:

message.writeTo(System.out)

shows it. Printing out the content of the part I can actually get at
prints the body of the email but this is all I can get. Any
suggestions on what I am missing here?

Thanks for your time!

I have little experience with TNEF but seem to recall something
about there being a single TNEF attachment, and that the other
attachments are inside the TNEF attachment.
 
S

sefner

I have little experience with TNEF but seem to recall something
about there being a single TNEF attachment, and that the other
attachments are inside the TNEF attachment.

Yep right, all the attachments are in a single TNEF attachment, the
problem is I cant get at this attachment through Javamail. I should be
seeing two parts, one part containing the text of the body of the email
and the other part containing any formatting instructions along with
all attachments grouped into a single TNEF attachment but I don't see
this second part.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,836
Messages
2,569,748
Members
45,545
Latest member
rapter____0

Latest Threads

Top