我的代碼來發送郵件請求失敗時,我嘗試使用Exchange Web服務
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
ExchangeCredentials credentials = new WebCredentials("[email protected]","pwd");
service.setCredentials(credentials);
service.setUrl(new URI("C:/shiva/Services.asmx"));
EmailMessage msg = new EmailMessage(service);
msg.setSubject("Hello world!");
msg.setBody(MessageBody.getMessageBodyFromText("Sent using the EWS Java API."));
msg.getToRecipients().add("[email protected]");
msg.send();
我得到當我跑上面的代碼
microsoft.exchange.webservices.data.core.exception.service.remote.ServiceRequestException: The request failed. Protocol C isn't supported for service request.
at microsoft.exchange.webservices.data.core.request.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:74).
.
.
.
.
Caused by: microsoft.exchange.webservices.data.core.exception.service.local.ServiceLocalException: Protocol C isn't supported for service request.
at microsoft.exchange.webservices.data.core.ExchangeServiceBase.prepareHttpWebRequestForUrl(ExchangeServiceBase.java:322).
.
.
.
請幫助下面的錯誤將郵件發送到Exchange Server我。
是的,@ Bill Shannon。謝謝。 –