I'm looking to parse an email .msg or .eml file using Tika. With the code below, I'm able to parse the email along with what is is inside of the attachment. However, I'd like to get the attachment text and name in a different object. Is this possible?
using (var stream = new BufferedInputStream(new FileInputStream(new File(pathToFile))))
{
var parser = new AutoDetectParser();
var handler = new BodyContentHandler();
var metadata = new Metadata();
parser.parse(stream, handler, metadata, new ParseContext());
var text = handler.toString();
}