This page uses CSS style sheets. See Web Standards

© 2007 auxilii.com

Examples

Examples

This page shows how to use the msgparser library to access to content of a .msg file.

For parsing the .msg file, a MsgParser object must be created. This parser can process .msg files stored in a file or coming from an InputStream.

MsgParser msgp = new MsgParser();
Message msg = msgp.parseMsg("mail.msg");


The resulting msg object contains all necessary information (e.g., from, to, subject).

String fromEmail = msg.getFromEmail();
String fromName = msg.getFromName();
String subject = msg.getSubject();


Attachments are stored in Attachment objects.

List<Attachment> atts = msg.getAttachments();
for (Attachment att : atts) {
// do something with attachment
}


An attachment is either a file (which is a FileAttachment object) or another attached .msg file (i.e, an .msg file in an .msg file) (which is a MsgAttachment object).