gpt4 book ai didi

java - 当 IMAP 文件夹关闭时,JavaMail API 如何删除邮件

转载 作者:行者123 更新时间:2023-11-30 08:12:57 25 4
gpt4 key购买 nike

我想知道,当 Folder.close(true) 时 JavaMail API 如何删除 IMAP 消息正在被调用吗?根据文档,“close”方法的唯一参数“expunge”确定是否删除先前标有\Deleted 标志的所有消息。在 source code (V. 1.4.7)但是,我在 close 方法(类 IMAPFolder)中看不到任何代码片段,它会删除任何内容或执行任何操作,甚至进入该方向。谁能帮我理解 expunge 参数的作用?

提前非常感谢您,祝您度过愉快的一天。

最佳答案

IMAPFolder.class,第 1310 行:

 // If the expunge flag is set, close the folder first.
if (expunge && protocol != null)
protocol.close();

IMAPProtocol.class,第 1201 行:

 /**
* CLOSE Command.
*
* @see "RFC2060, section 6.4.2"
*/
public void close() throws ProtocolException {
simpleCommand("CLOSE", null);
}

https://www.rfc-editor.org/rfc/rfc2060#section-6.4.2 :

The CLOSE command permanently removes from the currently selectedmailbox all messages that have the \Deleted flag set, and returns toauthenticated state from selected state. No untagged EXPUNGEresponses are sent.

No messages are removed, and no error is given, if the mailbox isselected by an EXAMINE command or is otherwise selected read-only.

Even if a mailbox is selected, a SELECT, EXAMINE, or LOGOUT commandMAY be issued without previously issuing a CLOSE command. The SELECT,EXAMINE, and LOGOUT commands implicitly close the currently selectedmailbox without doing an expunge. However, when many messages aredeleted, a CLOSE-LOGOUT or CLOSE-SELECT

关于java - 当 IMAP 文件夹关闭时,JavaMail API 如何删除邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30101573/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com