getUnreadMessageCount
public int getUnreadMessageCount()
                          throws MessagingException
Get the total number of unread messages in this Folder. 
This method can be invoked on a closed folder. However, note that for some folder implementations, getting the unread message count can be an expensive operation involving actually opening the folder. In such cases, a provider can choose not to support this functionality in the closed state, in which case this method must return -1. Clients invoking this method on a closed folder must be aware that this is a potentially expensive operation. Clients must also be prepared to handle a return value of -1 in this case. This implementation returns -1 if this folder is closed. Else this implementation gets each Message in the folder using getMessage(int) and checks whether its SEEN flag is set. The total number of messages that do not have this flag set is returned.Returns:
total number of unread messages. -1 may be returned by certain implementations if this method is invoked on a closed folder.
Throws:
FolderNotFoundException - if this folder does not exist.
MessagingException -  
==============================================================================
getNewMessageCount
public int getNewMessageCount()
                       throws MessagingException
Get the number of new messages in this Folder. 
This method can be invoked on a closed folder. However, note that for some folder implementations, getting the new message count can be an expensive operation involving actually opening the folder. In such cases, a provider can choose not to support this functionality in the closed state, in which case this method must return -1. Clients invoking this method on a closed folder must be aware that this is a potentially expensive operation. Clients must also be prepared to handle a return value of -1 in this case. This implementation returns -1 if this folder is closed. Else this implementation gets each Message in the folder using getMessage(int) and checks whether its RECENT flag is set. The total number of messages that have this flag set is returned.Returns:
number of new messages. -1 may be returned by certain implementations if this method is invoked on a closed folder.
Throws:
FolderNotFoundException - if this folder does not exist.
MessagingException -