在IMAP协议中,有一个文件夹层次结构字符。如果尝试创建名称中带有此类字符的文件夹,mailserver将创建两个文件夹。例如,如果一个分隔符是“/”,则命令CREATE "aaa/bbb"将创建两个文件夹aaa和bbb文件夹aaa。
是否可以创建带有分隔符的单个文件夹?例如,名称为的单个文件夹aaa/bbb,不带aaa和bbb位于aaa文件夹中。
@Pawel-尝试欺骗,不适用于鸽舍。诉诸于读取RFC。
正确的方法是创建一个带有尾随/的文件夹
这是一个示例(直接来自手动IMAP会话):
[root@mailer-daemon ~]# telnet localhost imap
Trying 127.0.0.1...
Connected to mailer-daemon.co (127.0.0.1).
Escape character is '^]'.
* OK Dovecot ready.
A1 LOGIN user password
A1 OK Logged in.
A1 LIST "" *
* LIST (\NoInferiors \UnMarked) "/" "Drafts"
* LIST (\NoInferiors \UnMarked) "/" "Deleted Messages"
* LIST (\NoInferiors \UnMarked) "/" "INBOX"
A1 OK List completed.
A1 CREATE test/
A1 OK Create completed.
A1 CREATE test/case
A1 OK Create completed.
A1 LIST "" test*
* LIST (\Noselect \HasChildren) "/" "test"
* LIST (\NoInferiors \UnMarked) "/" "test/case"
A1 OK List completed.
Run Code Online (Sandbox Code Playgroud)
这是RFC说的同样的话
If the mailbox name is suffixed with the server's hierarchy
separator character (as returned from the server by a LIST
command), this is a declaration that the client intends to create
mailbox names under this name in the hierarchy. Server
implementations that do not require this declaration MUST ignore
the declaration. In any case, the name created is without the
trailing hierarchy delimiter.
If the server's hierarchy separator character appears elsewhere in
the name, the server SHOULD create any superior hierarchical names
that are needed for the CREATE command to be successfully
completed. In other words, an attempt to create "foo/bar/zap" on
a server in which "/" is the hierarchy separator character SHOULD
create foo/ and foo/bar/ if they do not already exist.
If a new mailbox is created with the same name as a mailbox which
was deleted, its unique identifiers MUST be greater than any
unique identifiers used in the previous incarnation of the mailbox
UNLESS the new incarnation has a different unique identifier
validity value. See the description of the UID command for more
detail.
Run Code Online (Sandbox Code Playgroud)
我认为这是赚到的钱:
Example: C: A003 CREATE owatagusiam/
S: A003 OK CREATE completed
C: A004 CREATE owatagusiam/blurdybloop
S: A004 OK CREATE completed
Note: The interpretation of this example depends on whether
"/" was returned as the hierarchy separator from LIST. If
"/" is the hierarchy separator, a new level of hierarchy
named "owatagusiam" with a member called "blurdybloop" is
created. Otherwise, two mailboxes at the same hierarchy
level are created.
Run Code Online (Sandbox Code Playgroud)