I tried to access the all folders in mailbox, but I don't know the solution.
I can access inbox perfectly, but when I try the same with other folders I'm getting a "folder not found exception". Is there a solution for this problem?
Properties props = new Properties();
props.put("mail.imap.host", "abc.tech");
Session emailSession = Session.getDefaultInstance(props);
Store emailStore = emailSession.getStore("imap");
emailStore.connect("email", "password");
Folder emailFolder = emailStore.getFolder("Trash");
emailFolder.open(Folder.READ_WRITE);
Is there any way to print the trash folder size and access that in mailbox using Java Mail API?