Can't get mail MessageID or UID when messageRomoved listener fired I have set a MessageCountListener to a IMAP folder. When messages removed/Added the listeners are getting fired properly. In order to update the changes to my local client, I need messageID or UID. But inside the messageRemoved() method, when I try to get MessageID or UID, it throws a MessageRemoved exception. 
Is there a way to get messageID or UID inside messageRemoved() handler?

You can always get the message number for an expunged message.
If you've previously fetched the UID for a message, you should be able to get the UID of the message after it has been expunged.
You can't get the Message-ID or other headers for an expunged message.