java - Gmail fetching mails from Sent items as well -


i have following code connect inbox of mail server:

store popstore = popsession.getstore("pop3"); popstore.connect(address, username, password); folder  inboxfolder = popstore.getfolder("inbox"); 

post check new mails. when connect gmail, getting mails sent items when supposed inbox folder. yahoo working fine.

any idea can causing issue in gmail?

edit: have tried inbox , result same

following code snippet. when checked gmail, there no overlap between inbox , sent mail. (this should have been comment, posting answer formatting)

javax.mail.folder[] folders = store.getdefaultfolder().list("*"); (javax.mail.folder folder : folders) {     if ((folder.gettype() & javax.mail.folder.holds_messages) != 0) {         if (folder.getfullname().equalsignorecase("[gmail]/sent mail")                  || folder.getfullname().equalsignorecase("inbox")) {             system.out.println(folder.getfullname() + ": " + folder.getmessagecount());             folder.open(folder.read_only);             (message m : folder.getmessages(                                folder.getmessagecount() - 5,                                 folder.getmessagecount())) {                 system.out.println("m.getsubject() = " + m.getsubject());             }             folder.close(true);         }     } } 

Comments