JavaMail无法创建新的商店连接

时间:2016-04-05 05:40:20

标签: java javamail

我正在使用Java邮件API并在移动邮件时收到此错误。 下面是代码和例外。

  Session session = Session.getDefaultInstance(properties);
        Store store = session.getStore("imap");
        store.connect(ipAdd, userid , password);
          Folder inbox = store.getFolder("Inbox");
         inbox.open(Folder.READ_WRITE);
         Folder test = store.getFolder("Emails");
          //Create the destination folder if it does not exist
         if (!test.exists())
         test.create(Folder.HOLDS_MESSAGES);
         Message[] msgs = inbox.getMessages(from, to);
         inbox.copyMessages(msgs, test);
         inbox.setFlags(msgs, new Flags(Flags.Flag.DELETED), true);

         inbox.close(false);
         test.close(false); 

例外:

  • javax.mail.StoreClosedException:

0 个答案:

没有答案