我使用最新的java邮件api。我想重命名包含子项(子文件夹)的IMAP文件夹。假设我们有收件箱和收件箱有一个子文件夹 inbox.folder1 。 folder1有一个子文件夹,其全名是 inbox.folder1.subfolder1
我想将folder1重命名为folder2,我想要查看:
inbox.folder2.subfolder1
但是在代码之后
// folder instance corresponds to folder1
newFolder = folder.getFolder(newName); //newName = "folder2"
folder.renameTo(newFolder);
如果您使用outlook或thunderbird进行连接
inbox.folder1.subfolder1
inbox.folder2
我们有两个文件夹,但我希望有一个。并且子文件夹1仍然位于folder1中。并且您无法输入文件夹或子文件夹1,它们会生成错误消息:原因:邮箱不存在或必须订阅。
我应该使用setSubscripbed(true / false)吗?我是否必须通过迭代每个子文件夹来单独处理它们?
答案 0 :(得分:0)
https://wiki.mozilla.org/MailNews:Logging#Environment_Variables_to_set
然后我重命名了一个包含许多子文件夹的文件夹。
如您所见,您必须使用新名称调用订阅文件夹,并使用日志文件中指定的顺序使用旧名称取消订阅。
如果不调用subscribe / unsubscribe方法调用,则会在邮件服务器控制台中收到消息
68确定文件夹已重命名。
但这还不够,你的文件夹结构已损坏。
9944 [ab79a70]:7cea000:192.168.0.104:A:SendData:68 rename" INBOX.folder1" " INBOX.folder2" 9944 [ab79a70]:ReadNextLine [stream = a6db068 nb = 23 needmore = 0] 9944 [ab79a70]:7cea000:192.168.0.104:A:CreateNewLineFromSocket:68确定重命名文件夹。 9944 [ab79a70]:7cea000:192.168.0.104:A:SendData:69 subscribe" INBOX.folder2" 9944 [ab79a70]:ReadNextLine [stream = a6db068 nb = 26 needmore = 0] 9944 [ab79a70]:7cea000:192.168.0.104:A:CreateNewLineFromSocket:69 OK文件夹订阅。 9944 [ab79a70]:7cea000:192.168.0.104:A:SendData:70取消订阅" INBOX.folder1" 9944 [ab79a70]:ReadNextLine [stream = a6db068 nb = 28 needmore = 0] 9944 [ab79a70]:7cea000:192.168.0.104:A:CreateNewLineFromSocket:70 OK文件夹取消订阅。 9944 [ab79a70]:7cea000:192.168.0.104:A:SendData:71 subscribe" INBOX.folder2.subfolder1.subsubfolder1.subsubsubfolder1b" 9944 [ab79a70]:ReadNextLine [stream = a6db068 nb = 26 needmore = 0] 9944 [ab79a70]:7cea000:192.168.0.104:A:CreateNewLineFromSocket:71 OK文件夹订阅。 9944 [ab79a70]:7cea000:192.168.0.104:A:SendData:72取消订阅" INBOX.folder1.subfolder1.subsubfolder1.subsubsubfolder1b" 9944 [ab79a70]:ReadNextLine [stream = a6db068 nb = 28 needmore = 0] 9944 [ab79a70]:7cea000:192.168.0.104:A:CreateNewLineFromSocket:72 OK文件夹取消订阅。 9944 [ab79a70]:7cea000:192.168.0.104:A:SendData:73 subscribe" INBOX.folder2.subfolder1.subsubfolder1.subsubsubfolder1a" 9944 [ab79a70]:ReadNextLine [stream = a6db068 nb = 26 needmore = 0] 9944 [ab79a70]:7cea000:192.168.0.104:A:CreateNewLineFromSocket:73 OK文件夹订阅。 9944 [ab79a70]:7cea000:192.168.0.104:A:SendData:74取消订阅" INBOX.folder1.subfolder1.subsubfolder1.subsubsubfolder1a" 9944 [ab79a70]:ReadNextLine [stream = a6db068 nb = 28 needmore = 0] 9944 [ab79a70]:7cea000:192.168.0.104:A:CreateNewLineFromSocket:74 OK文件夹取消订阅。 9944 [ab79a70]:7cea000:192.168.0.104:A:SendData:75 subscribe" INBOX.folder2.subfolder3.subsubfolder3" 9944 [ab79a70]:ReadNextLine [stream = a6db068 nb = 26 needmore = 0] 9944 [ab79a70]:7cea000:192.168.0.104:A:CreateNewLineFromSocket:75 OK文件夹订阅。 9944 [ab79a70]:7cea000:192.168.0.104:A:SendData:76取消订阅" INBOX.folder1.subfolder3.subsubfolder3" 9944 [ab79a70]:ReadNextLine [stream = a6db068 nb = 28 needmore = 0] 9944 [ab79a70]:7cea000:192.168.0.104:A:CreateNewLineFromSocket:76 OK文件夹取消订阅。 9944 [ab79a70]:7cea000:192.168.0.104:A:SendData:77 subscribe" INBOX.folder2.subfolder3" 9944 [ab79a70]:ReadNextLine [stream = a6db068 nb = 26 needmore = 0] 9944 [ab79a70]:7cea000:192.168.0.104:A:CreateNewLineFromSocket:77 OK文件夹订阅。 9944 [ab79a70]:7cea000:192.168.0.104:A:SendData:78取消订阅" INBOX.folder1.subfolder3" 9944 [ab79a70]:ReadNextLine [stream = a6db068 nb = 28 needmore = 0] 9944 [ab79a70]:7cea000:192.168.0.104:A:CreateNewLineFromSocket:78 OK文件夹取消订阅。 9944 [ab79a70]:7cea000:192.168.0.104:A:SendData:79 subscribe" INBOX.folder2.subfolder1.subsubfolder1" 9944 [ab79a70]:ReadNextLine [stream = a6db068 nb = 26 needmore = 0] 9944 [ab79a70]:7cea000:192.168.0.104:A:CreateNewLineFromSocket:79 OK文件夹订阅。 9944 [ab79a70]:7cea000:192.168.0.104:A:SendData:80取消订阅" INBOX.folder1.subfolder1.subsubfolder1" 9944 [ab79a70]:ReadNextLine [stream = a6db068 nb = 28 needmore = 0] 9944 [ab79a70]:7cea000:192.168.0.104:A:CreateNewLineFromSocket:80 OK文件夹取消订阅。 9944 [ab79a70]:7cea000:192.168.0.104:A:SendData:81 subscribe" INBOX.folder2.subfolder2" 9944 [ab79a70]:ReadNextLine [stream = a6db068 nb = 26 needmore = 0] 9944 [ab79a70]:7cea000:192.168.0.104:A:CreateNewLineFromSocket:81 OK文件夹订阅。 9944 [ab79a70]:7cea000:192.168.0.104:A:SendData:82取消订阅" INBOX.folder1.subfolder2" 9944 [ab79a70]:ReadNextLine [stream = a6db068 nb = 28 needmore = 0] 9944 [ab79a70]:7cea000:192.168.0.104:A:CreateNewLineFromSocket:82 OK文件夹取消订阅。 9944 [ab79a70]:7cea000:192.168.0.104:A:SendData:83 subscribe" INBOX.folder2.subfolder1" 9944 [ab79a70]:ReadNextLine [stream = a6db068 nb = 26 needmore = 0] 9944 [ab79a70]:7cea000:192.168.0.104:A:CreateNewLineFromSocket:83 OK文件夹订阅。 9944 [ab79a70]:7cea000:192.168.0.104:A:SendData:84取消订阅" INBOX.folder1.subfolder1" 9944 [ab79a70]:ReadNextLine [stream = a6db068 nb = 28 needmore = 0] 9944 [ab79a70]:7cea000:192.168.0.104:A:CreateNewLineFromSocket:84 OK文件夹取消订阅。