u013051005
屌丝程序员甲
2015-12-25 07:46

java怎么连接exchange收发邮件

  • 密码
  • exception
  • java
  • 浏览器
  • exchange
public static void main(String[] args) {
    Exchange.conn();
}



public static void conn(){
    boolean result = false;
    ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);
    ExchangeCredentials credentials = new WebCredentials(用户名,密码,域);
    service.setCredentials(credentials);
    try {
        service.setUrl(new URI("https://192.168.1.124/EWS/Exchange.asmx"));

        Folder inbox = Folder.bind(service, WellKnownFolderName.Inbox);
        System.out.println(service.getTimeout());

    } catch (Exception e) {
        e.printStackTrace();
    }
}

总是报microsoft.exchange.webservices.data.ServiceLocalException: https://192.168.1.124/EWS/Exchange.asmx : Connection error

浏览器可以打开这个连接,但是需要输入用户密码,还有代码中的用户密码各是指什么?

崩溃中。。。。

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答