I want to view other folders in my hotmail account, besides the Inbox.
String host = "pop3.live.com";
String username = "[email protected]";
String password = "peepantspants";
Properties pop3Props = new Properties();
pop3Props.setProperty("mail.pop3s.port", "995");
Session session = Session.getInstance(pop3Props, null);
Store store = session.getStore("pop3s");
store.connect(host, 995, username, password);
Folder folder = store.getFolder("INBOX"); //this works fine
folder.open(Folder.READ_WRITE);
Folder[] f = store.getDefaultFolder().list("*");
for (int i = 0; i < f.length; i++ )
System.out.println( f[i].getFullName() ); //this only prints INBOX
Folder ofolder = store.getFolder("MyOtherFolder"); //this doesn't work
ofolder.open(Folder.READ_WRITE);
Message messages[] = folder.getMessages();
folder.copyMessages(new Message[]{messages[0]}, ofolder); //this doesn't work
I cannot get into any other folder, besides Inbox.
store.getFolder("MyOtherFolder")
throws the following error
Exception in thread "main" javax.mail.FolderNotFoundException: folder is not INBOX
at com.sun.mail.pop3.POP3Folder.open(POP3Folder.java:199)
You can't. The POP3 protocol only supports a single mailbox. As far as I know, Hotmail still doesn't support any other standard protocols such as IMAP that would allow access to other mailboxes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With