I’m writing a POP3MailConnector. With the following Code i’m getting the messages from the store:
Store store = null;
try {
store = session.getStore();
store.connect();
Folder folder = store.getFolder("INBOX");
folder.open(Folder.READ_ONLY);
Message[] messages = folder.getMessages();
.
.
.
}
message.getContent() displays the content of the message, but message.getAllHeaders() returns no values and is always null.
When the message is load with FileInputStream all Headers contain values.
I’m testing with a local James Mailserver and hMailServer.
Does anyone has an idea, while the header is always null, when using folder.getMessages() ?
After a long time of searching, i found the solution. The order of the maven dependencies is important. The java mail dependency must be set at the first position! That’s it.