I'am
          reading a Amazon WorkMail folder using javax.mail v1.4, and
          getMessageCount from folders class is returning wrong values
          (per example, instead of 15 e-mails, 33 are being returned).
          Here is the code:
        Session session = Session.getInstance(props);
Store store = session.getStore(mail.getMailProtocol().getProtocol());
store.connect(mail.getMailProtocol().getHost(),mail.getMailProtocol().getUser(),
                            mail.getMailProtocol().getPassword());
Folder inbox = store.getFolder(mail.getMailProtocol().getFolder());
inbox.open(Folder.READ_WRITE);
System.out.println(inbox.getMessageCount());
        I'm
          using imap protocol, using the following properties:
        props.setProperty("mail.store.protocol", "imaps");
props.put("mail.imaps.ssl.trust", "*");
        Obs:
          I'am reading INBOX folder.
        Can
          someone help me to find if there is something wrong ? Thanks
          folks!
        
          Edit
              1
        
        Here
          is some debug from java mail, there is only 3 emails, but
          getMessageCount shows 15
        A1 OK Logged in
 DEBUG: connection available -- size: 1
 A2 SELECT INBOX
 * FLAGS (\Answered \Flagged \Deleted \Seen \Draft $Forwarded)
 * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft $Forwarded)] 
 Flags permitted.
 * 15 EXISTS
 * 0 RECENT
        
        
        -- 
        
          
            Best regards,
            Ramon Lacava Gutierrez Gonçales