简体   繁体   English

使用Java通过同一用户帐户访问多个电子邮件箱

[英]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. 例如:如果用户A有两个帐户。 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? Java或Javamail API中是否可以访问这两个帐户的文件夹?

 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. 为每个帐户创建一个不同的Store对象,然后以这种方式访问​​它们。 Its up to your interface to make it look seamless to the user. 它取决于您的界面,以使用户看起来无缝。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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