Hi all,
we have an application checking the INBOX (using imap protocol) for new e-mails every day, by applying the following filter:
Message[] messages = folder.search(new AndTerm(new FromTerm(new InternetAddress(myAddres)),
new FlagTerm(new Flags(Flags.Flag.SEEN), false)));
in order to get only the new e-mails coming from the specified address.
After getting the messages, the application does some logic and then sets the flag SEEN to every single message:
message.setFlag(SEEN, true);
The application had been working properly till a few days ago when the mail server was updated (from 5.0.12 to release 6.5.5). The server is Lotus Domino.
From then on the application is getting all the messages from the specified address, the SEEN ones too.
I've done some testing and it seems that the AndTerm is not working properly. I've tried to get all new messages
Message[] messages = folder.search(new FlagTerm(new Flags(Flags.Flag.SEEN), false));
and it works.
If I change the order of the search terms, it works properly, but I can't understand why:
Message[] messages = folder.search(new AndTerm(new FlagTerm(new Flags(Flags.Flag.SEEN), false),
new FromTerm(new InternetAddress(myAddress))));
Can anyone help me to understand this behaviour?
Thanks,
mavenez