Imap4req1中的Subscribe和Unsubscribe命令有什么用?我检查了RFC 3501,但我无法理解它的用途。当我写下以下命令时会发生什么
A SUBSCRIBE "MAILBOX_NAME"
A UNSUBSCRIBE "MAILBOX_NAME"
服务器会将这些邮箱视为单独的邮箱吗?
示例:
请在下面查看一次,并告诉差异
A LIST "" "*"
* LIST (\HasNoChildren) "/" "Bulk Mail"
* LIST (\HasNoChildren) "/" "Draft"
* LIST (\HasNoChildren) "/" "Inbox"
* LIST (\HasNoChildren) "/" "Sent"
* LIST (\HasNoChildren) "/" "Trash"
A OK LIST completed
A SUBSCRIBE INBOX
A OK SUBSCRIBE completed
A LSUB "" "*"
* LSUB (\HasNoChildren) "/" "Bulk Mail"
* LSUB (\HasNoChildren) "/" "Draft"
* LSUB (\HasNoChildren) "/" "Inbox"
* LSUB (\HasNoChildren) "/" "Sent"
* LSUB (\HasNoChildren) "/" "Trash"
A OK LSUB completed
答案 0 :(得分:4)
他们更改了LSUB
命令的输出。而已。 SUBSCRIBE
将文件夹添加到LSUB
命令的输出中。 UNSUBSCRIBE
将从LSUB
命令的输出中删除它们。也就是说,LSUB
仅显示订阅的文件夹。
LIST
将始终显示所有文件夹。
例如,从订阅的所有文件夹开始:
a LIST "" *
* LIST (\HasNoChildren) "." "INBOX.Drafts"
* LIST (\HasNoChildren) "." "INBOX.Sent"
* LIST (\HasNoChildren) "." "INBOX.Trash"
* LIST (\Marked \HasChildren) "." "INBOX"
a OK LIST completed
a LSUB "" *
* LSUB (\Marked \HasChildren) "." "INBOX"
* LSUB (\HasNoChildren) "." "INBOX.Drafts"
* LSUB (\HasNoChildren) "." "INBOX.Sent"
* LSUB (\HasNoChildren) "." "INBOX.Trash"
a OK LSUB completed
现在让我们取消订阅INBOX.Sent
:
a UNSUBSCRIBE INBOX.Sent
a OK Folder unsubscribed.
a LSUB "" *
* LSUB (\Marked \HasChildren) "." "INBOX"
* LSUB (\HasNoChildren) "." "INBOX.Drafts"
* LSUB (\HasNoChildren) "." "INBOX.Trash"
a OK LSUB completed
所有不同的是,INBOX.Sent
已从LSUB输出中删除。请注意,LIST输出根本不会受到影响。
现在让我们把它放回去:
a SUBSCRIBE INBOX.Sent
a OK Folder subscribed.
a LSUB "" *
* LSUB (\HasNoChildren) "." "INBOX.Sent"
* LSUB (\Marked \HasChildren) "." "INBOX"
* LSUB (\HasNoChildren) "." "INBOX.Drafts"
* LSUB (\HasNoChildren) "." "INBOX.Trash"
a OK LSUB completed
它们通常用于客户端标记用户有兴趣看到的文件夹。