简体   繁体   中英

Access Multiple Email Boxes through Same user Account using Java

I am trying to read additional email boxes for a single user. For Example : if user A has two account. one its own and one more additionally configured for it. Is there a way in Java or Javamail API to access folders for both these accounts?

 store.connect("mail.abc.com","user","password");

  // Get a handle on the default folder
  folder = store.getFolder("inbox"); ///This works fine
 Folder[] f = store.getFolder("additionalbox").list(); // this doesnot work
 for(Folder fd : f){
     System.out.println(">>" +  fd.getName());
 }

Hierarchy is :

 user
     inbox

additionalbox
      inbox

Is there any way to achieve it ?

Create a different Store object for each account and access them that way. Its up to your interface to make it look seamless to the user.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM