Get just main email, from a mail with many answers

Hello,

I am trying to extract the contents of the HTML Outlook message using the following Java code:

MailMessage msgFile = MailMessage.load(inputFileName + “.” + extensionFile);

MapiMessage msg = MapiMessage.fromMailMessage(msgFile, com.aspose.email.MapiConversionOptions.getUnicodeFormat());

java.io.BufferedWriter resultWriter = new java.io.BufferedWriter(new java.io.FileWriter(outputFileName));

resultWriter.write(msg.getBodyHtml());

resultWriter.close();

I can get the content, is working great.

But I need to know if there is any way to get only the main message (not all message chains, in case the message is a response to a previous message).

I can´t see any code for that on the API doc, the html to separeate a mail from others is just a

with some style to add a border to the top. (very generic, not even a class name or a div id.)

Thanks in advance.

@rparletta,

I have observed the following requirement shared by you and like to share that it is not a limitation in API. The message chain is part of HTML Body encapsulated in a MSG file. So, for API, it is a MSG body. In your case, you may try some combination of finding matching string like <From in your extracted MSG Body and truncate after that. This is a only one possible thought and may or may not apply on your end.