使用mstor瓦特/ Windows中,我能够连接到MBOX店(感谢SO)。我似乎可以阅读消息指针;我知道这一点,因为每当我遍历商店时,它都会迭代正确的消息数量。问题是没有标题和内容正在加载!任何想法?mstor阅读MBOX文件,但返回null
是的,我在classpath中(它有mstor的lib这些天)的JavaMail的东西。我甚至在mstor的示例文件(imagined.mbox)中使用它。
在此先感谢。
我的代码:
public static void main(String[] args) throws Exception {
Properties props = new Properties();
props.setProperty("mstor.mbox.metadataStrategy", "xml");
Session session1 = Session.getDefaultInstance(props);
Session session = Session.getDefaultInstance(new Properties());
Store store = session.getStore(new URLName("mstor:C:/tmp/imagined.mbox"));
store.connect();
System.out.println(store.isConnected());
Folder inbox = store.getDefaultFolder(); // no subfolder here; even if there is an Inbox, I get the same thing...
inbox.open(Folder.READ_ONLY);
Message[] messages = inbox.getMessages();
for (Message m : messages) {
System.out.println(m.getSubject());
}
}
我的典型结果:
true (i.e., yes, I'm connected...)
null
null
null
null
为什么这样做/为什么需要它?我从一些Clojure代码中使用了它,它也解决了我的问题... – 2014-11-27 16:37:19
因为我工作了很长时间...我认为它是API中的一个错误,它从缓存中读取消息在缓存之前的某种。如果它适合你,请提出答案。 – 2015-04-17 12:47:21
看到我上面的答案,这几乎是你说的。最终禁用缓存完成了任务。 – 2015-04-27 14:37:03