I'm using the latest spring integration (4.1.5) javax.mail (1.4.7) libraries but looks like this issue is sitting there from the beginning.
I'm trying to get received date from mail server via IMAP protocol but SI always returns null. This is because of row 301 in https://github.com/spring-projects/spring-integration/blob/4.1.x/spring-integration-mail/src/main/java/org/springframework/integration/mail/AbstractMailReceiver.java
MimeMessage mimeMessage = new IntegrationMimeMessage((MimeMessage) filteredMessages[i]);
So instead of let me get IMAPMessage instance it makes me to get MimeMessage that has stub for method getReceivedDate:
public Date getReceivedDate() throws MessagingException {
return null;
}
I see that header contains not null element Received so the only option I see is to parse this header manually.
Is it correct behaviour of SI? Bug or feature? And how to avoid manual parsing of received date header?
I've been looking at the Sun code; it uses the
INTERNALDATE
fetch item to populate thereceivedDate
property...Line 1194 in javamail 1.5.2...
However, Spring does not expose this; I have created a JIRA issue.