How can I tell the JavaMail API where to create a mail folder on my IMAP server?

Christopher Koenigsberg

The JavaMail API, for an IMAP server, sends the IMAP command, to create a new folder, to the IMAP server. JavaMail does not create anything; the IMAP server creates the folder, when requested to by the JavaMail API's IMAP client commands.

And then it's up to the IMAP server, where it wants to create this new folder, given its own configuration, in the underlying local filesystem, for folder locations relative to users' home directories (e.g. "/path/to/user1/path/to/folder1").

The IMAP server has to be able to FIND a folder, so it can't just create a folder anywhere; it has to create the folder in the place it knows to look for them, for a particular user. Either this is a single fixed location (e.g. "/home/user1/folder1") or it might have a folder search path taking multiple alternative possibilities, and this depends on the IMAP server. This has nothing to do with the JavaMail API.