Hi i am having problem with reading mails from manually created folder.
i can read mails from INBOX. but when i try to read mail from other than inbox it is giving error.
I hope stackoverflow will give solution. Thanks in advance...
Error Message:
Exception in thread "main" javax.mail.FolderNotFoundException: folder is not INBOX at com.sun.mail.pop3.POP3Folder.open(POP3Folder.java:183) at MailPop3.main(MailPop3.java:24)
My Code:
Properties properties = System.getProperties();
Session session = Session.getDefaultInstance(properties);
Store store = session.getStore("pop3");
store.connect(host, user, password);
Folder inbox = store.getFolder("MyPersonalFolder");
inbox.open(Folder.READ_ONLY);
// search for all "unseen" messages
Flags seen = new Flags(Flags.Flag.SEEN);
FlagTerm unseenFlagTerm = new FlagTerm(seen, false);
Message messages[] = inbox.search(unseenFlagTerm);