mail imap noop命令

版权声明: https://blog.csdn.net/luoshabugui/article/details/82872503

一 文档说明

摘自rfc3501

6.1.2. NOOP Command
Arguments: none
Responses: no specific responses for this command (but see below)
Result:  
    OK - noop completed
    BAD - command unknown or arguments invalid
The NOOP command always succeeds. It does nothing.
Since any command can return a status update as untagged data, the NOOP command can be used as a periodic poll for new messages or message status updates during a period of inactivity (this is the preferred method to do this). The NOOP command can also be used to reset any inactivity autologout timer on the server.

noop命令总是返回成功,但是当服务器有新消息或者消息状态发生改变时,服务器在noop命令响应前会进行响应。

二 举例

C: a002 NOOP
S: a002 OK NOOP completed
. . .
C: a047 NOOP
S: * 22 EXPUNGE   // 邮件序号 删除
S: * 23 EXISTS    // 收取后,有新邮件到达,邮件总数量,也是当前最大的邮件序号
S: * 3 RECENT    // 收取后,有新邮件到达,但没被收取过的数量。(关闭其他邮件客户端时,与EXISTS一起出现)
S: * 14 FETCH (FLAGS (\Seen \Deleted)) // 邮件序号 标签发生改变
S: a047 OK NOOP completed

三 讨论

noop是imap的全局命令,既然涉及到邮件序号,那么要处理该类服务器响应,是否应该先进行select命令。

猜你喜欢

转载自blog.csdn.net/luoshabugui/article/details/82872503
今日推荐