从Java应用程序从MS Exchange Server检索邮件 [英] Retrieving mails from MS Exchange Server from Java application

查看:84
本文介绍了从Java应用程序从MS Exchange Server检索邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在MS Exchange中收到新邮件时,有哪些在Java应用程序中启动方法的选项?是否为此提供某种Web服务?还是可以从Outlook文件夹中获取它?还是我应该像这样使用Java Mail-每隔几秒钟检查收件箱文件夹:

What are the options for starting a method in Java app when I receive a new mail in MS Exchange? Is there some kind of web service for this? Or can I get it from the Outlook folder? Or should I use Java Mail like this - checking inbox folder every few seconds:

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));

这对我来说似乎是最自然的,但是公司Exchange服务器上当前未激活IMAP,我想找到其他解决方法.

This one looks the most natural to me but IMAP is not currently activated on the company Exchange server and I would like to find some other way to solve this.

还有其他选择吗?

推荐答案

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

Look for Java APIs called JWebDAV and JWebServices for Exchange. It is Java implementation of WebDAV and EWS protocol.

这篇关于从Java应用程序从MS Exchange Server检索邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆