我正在使用Tika解析EML文件(RFC822),但由于某种原因我无法获取附件名称。我得到了身体,咒语,抄送,密件抄送,附件文本等,但没有附件名称。有任何想法吗?以下是我正在使用的代码。
var handler = new BodyContentHandler();
Metadata metadata = new Metadata();
FileInputStream inputstream = new FileInputStream(new File(@"C:\Users\test\Desktop\testemail.eml"));
ParseContext pcontext = new ParseContext();
var parser = new RFC822Parser();
parser.parse(inputstream, handler, metadata, pcontext);
Debug.WriteLine("Contents of the document:" + handler.toString());
Debug.WriteLine("Metadata of the document:");
String[] metadataNames = metadata.names();
foreach (String name in metadataNames)
{
Debug.WriteLine(name + ": " + metadata.get(name));
}