protected Map<String, Object> extractHeadersFromMail(Message mailMessage, Exchange exchange) throws MessagingException {
Map<String, Object> answer = new HashMap<String, Object>();
Enumeration names = mailMessage.getAllHeaders();
while (names.hasMoreElements()) {
Header header = (Header) names.nextElement();
String value = header.getValue();
if (headerFilterStrategy != null && !headerFilterStrategy.applyFilterToExternalHeaders(header.getName(), value, exchange)) {
CollectionHelper.appendValue(answer, header.getName(), value);
}
}
return answer;
}