0

当我在 MS Exchange 中收到新邮件时,在 Java 应用程序中启动方法的选项有哪些?有某种网络服务吗?或者我可以从 Outlook 文件夹中获取它吗?或者我应该像这样使用 Java Mail - 每隔几秒钟检查一次收件箱文件夹:

Properties props = System.getProperties();
 props.setProperty("mail.store.protocol", "imaps"); 
 Session session = Session.getDefaultInstance(props, null);
 Store store = session.getStore("imaps");
 store.connect("<impap_address>","<mail ID> ", "<Password>");

 inbox = store.getFolder("Inbox");
 System.out.println("No of Unread Messages : " + inbox.getUnreadMessageCount());
 inbox.open(Folder.READ_ONLY);

 /*  Get the messages which is unread in the Inbox*/
 Message messages[] = inbox.search(new FlagTerm(new Flags(Flag.SEEN), false));

这对我来说看起来最自然,但 IMAP 目前在公司 Exchange 服务器上没有激活,我想找到其他方法来解决这个问题。

还有其他选择吗?

4

2 回答 2

2

查找名为 JWebDAV 和 JWebServices for Exchange 的 Java API。它是 WebDAV 和 EWS 协议的 Java 实现。

于 2012-07-24T08:47:18.463 回答
1

Exchange 有web服务,但作为 .Net 开发人员,我只使用官方 SDK 使用它,它是 web 服务的包装器。Exchange 2003 和 2007 有一个webdav界面,但它已在 2010 年被删除。这两种方法都应该与所使用的客户端技术无关,但我没有从 Java 中使用它的第一手经验。

于 2012-07-23T12:52:55.017 回答