Search code examples
imap

Is there any legal way to create IMAP folder with hierarchy separator character in the name?


In the IMAP protocol there is a folder hierarchy character. If you try to create folder with such character in the name, mailserver will create two folders. For example, if a delimiter character is "/", then command CREATE "aaa/bbb" will create two folders aaa and bbb in folder aaa.

Is it possible to create single folder with delimiter character inside? For example, the single folder with the name aaa/bbb, without aaa and bbb in aaa folder.


Solution

  • You may try UTF7 encoding:

    CREATE "one&AC8-two"
    

    But RFC says:

    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."

    http://www.faqs.org/rfcs/rfc3501.html