JavaMail API 如何在 IMAP 文件夹关闭时删除消息
How does JavaMail API expunge messages when IMAP folder is closed
我想知道,当 Folder.close(true) is being called? According to the docs, the only parameter "expunge" of method "close" determines whether to expunge all messages that have been previously marked with a \Deleted flag. In the source code (V. 1.4.7) 时,JavaMail API 是如何删除 IMAP 消息的,但是,我在方法关闭 (class 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 selected
mailbox all messages that have the \Deleted flag set, and returns to
authenticated state from selected state. No untagged EXPUNGE
responses are sent.
No messages are removed, and no error is given, if the mailbox is
selected by an EXAMINE command or is otherwise selected read-only.
Even if a mailbox is selected, a SELECT, EXAMINE, or LOGOUT command
MAY be issued without previously issuing a CLOSE command. The SELECT,
EXAMINE, and LOGOUT commands implicitly close the currently selected
mailbox without doing an expunge. However, when many messages are
deleted, a CLOSE-LOGOUT or CLOSE-SELECT
我想知道,当 Folder.close(true) is being called? According to the docs, the only parameter "expunge" of method "close" determines whether to expunge all messages that have been previously marked with a \Deleted flag. In the source code (V. 1.4.7) 时,JavaMail API 是如何删除 IMAP 消息的,但是,我在方法关闭 (class 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 selected mailbox all messages that have the \Deleted flag set, and returns to authenticated state from selected state. No untagged EXPUNGE responses are sent.
No messages are removed, and no error is given, if the mailbox is selected by an EXAMINE command or is otherwise selected read-only.
Even if a mailbox is selected, a SELECT, EXAMINE, or LOGOUT command MAY be issued without previously issuing a CLOSE command. The SELECT, EXAMINE, and LOGOUT commands implicitly close the currently selected mailbox without doing an expunge. However, when many messages are deleted, a CLOSE-LOGOUT or CLOSE-SELECT