Reputation: 2669
I've outlook email data in the firm of EML
files. There are various levels of nesting of attachments.
Is there a generic way to extract the attached .msg
and its attachments recursively?
A full piece of code or relevant code snippet would be much more helpful than plain approach.
Upvotes: 2
Views: 1051
Reputation: 697
You might consider using a library called msgparser.
They list some very basic usage examples:
MsgParser msgp = new MsgParser();
Message msg = msgp.parseMsg("mail.msg");
String fromEmail = msg.getFromEmail();
String fromName = msg.getFromName();
String subject = msg.getSubject();
List<Attachment> atts = msg.getAttachments();
for (Attachment att : atts) {
// do something with attachment
}
Upvotes: 1