title: Reading mails from folder in yahoo by Javamail
body: <p>Hi i am having problem with reading mails from manually created folder.</p>
  
  <p>i can read mails from INBOX. but when i try to read mail from other than inbox it is giving error.</p>
  
  <p>I hope stackoverflow will give solution.
  Thanks in advance...</p>
  
  <p><em><strong>Error Message:</em></strong></p>
  
  <p><strong>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)</strong></p>
  
  <p><em><strong>My Code:</em></strong></p>
  
  <pre><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);
  </code></pre>