I use
receiveEmailAndMarkSeen(EmailFilter.filter().flag(Flags.Flag.SEEN,true));
to filter the message which I don't read, but the function returns empty array. If I set false it returns all the message.
I test many times, I don't know what's wrong
Could someone help me?
This may depend on the target server. Are you using IMAP or POP server? IMAP is the one that usually works better with your use case.
Here is an example that worked for me:
My mailbox:
Program output:
p.s. try to download all emails and check the
Flagof received emails. Also, use IMAP.