Retrieving email message flags |
Upon establishing a connection to an IMAP server you may retrieve an email message along with it's message flags using the Imap#getMessageWithFlags method. The ImapMessage class is a convenience class which contains reference to the message flags and the email message retrieved.
Example
// establish connection imap.connect();
// retrieves first message in mailbox ImapMessage message = imap.getMessageWithFlags(1);
// check message flags boolean answered = message.isAnswered(); boolean deleted = message.isDeleted(); boolean draft = message.isDraft(); boolean recent = message.isRecent(); boolean seen = message.isSeen();
// get email message EmailMessage email = message.getMessage();
|