diff --git a/src/java/davmail/exchange/ExchangeSession.java b/src/java/davmail/exchange/ExchangeSession.java index a15e6f79..5f86678d 100644 --- a/src/java/davmail/exchange/ExchangeSession.java +++ b/src/java/davmail/exchange/ExchangeSession.java @@ -1127,7 +1127,12 @@ public class ExchangeSession { if (status != HttpStatus.SC_OK) { throw new IOException("Unable to get user email from: " + getMethod.getPath()); } - email = XMLStreamUtil.getElementContentByLocalName(getMethod.getResponseBodyAsStream(), "EM"); + Map> results = XMLStreamUtil.getElementContentsAsMap(getMethod.getResponseBodyAsStream(), "item", "AN"); + Map result = results.get(userName); + if (result != null) { + email = result.get("EM"); + } + } finally { getMethod.releaseConnection(); }