.:: CODE SNIPPET ::.

"Your time is limited, so don't waste it living someone else's life"

Tag Archives: mail

Extract content and attachments from an Message use Javax mail (with embedded message EML, MSG)


The main part in a javax message is the content. The content can be any Java object representing the mail content, like a plain text (String) or raw image data or even a multiple part object. A multiple part content a message’s content consists of more than a single item. A multiple part object is a container which holds one ore more BodyPart objects. These BodyParts, like a message, have a content and a content type (in fact, both message and BodyPart implement the same interface Part which carries these properties).

Beside plain content, A BodyPart can contain another Multipart or even another Message, a so called nested message (e.g. a forwarded message, called embedded message) with content type ‘message/rfc822’.

As you can see, the structure of a message can be rather heterogeneous, a tree with nodes of different types. The following picture illustrates the tree structure for a sample message.
Read more of this post

Advertisements
%d bloggers like this: