Shared folders

This document describes how shared folders are implemented by Courier-IMAP, and SqWebMail, within the framework of the Maildir mail store format. Having the ability to implement shared folders was badly needed for some time. And finally, there's a way to do it!

Terminology

Technical Overview

Functional Overview

Generally speaking, shared folders are configured using a feature-enhanced maildirmake command as follows:

Also, note that anyone, not just the superuser, can create a sharable maildir in their account, and invite anyone else to access it, as long as their system user/group permissions allow them access.

To summarize:

For more information on these options, see the maildirmake manual page that will be installed.

More on additional options for the maildirmake command

The '-S' option to maildirmake to create a maildir that will contain shared folders. The -S option gives group and world read permissions on the maildir itself (where group/world permissions are normally not set for a regular maildir). This allows access to any folders in the shared maildir, and that's why you should not use this Maildir directly as your primary mailbox.

The "new" and "cur" subdirectories will not be used or shared, although they will still be created. Both SqWebMail and Courier-IMAP create their auxiliary files in the main Maildir with the group and world permissions turned off, so this maildir can, theoretically, still be used as the primary INBOX, but I don't recommend that.

The -S option is not limited to the system administrator. In fact, anyone can use the -S option, to create shared maildirs that they maintain.

Shared folders are created like any other folder, using the -f option to maildirmake. However, that normally creates a folder that is not sharable, because it will not have any group or world permissions. Therefore, maildirmake will take the following options to create a sharable folder:

It's worth noting that it is perfectly permissible for folders in the same sharable maildir to have different access levels.

Also, this is driven entirely by filesystem permissions, so theoretically it's possible to create a folder that has write permissions for the group, and read permissions for everyone else. However, I'm too lazy to actually do it. Feel free to patch maildirmake to add this functionality, then send me the patch.

Accessing shared folders

The rest of the document consists of technical implementation notes.

Accessing a collection of shared folders is implemented by a new file that is installed in the primary maildir (usually $HOME/Maildir), and a new subdirectory hierarchy underneath the primary maildir, which are hereby declared.

shared-maildirs

This file must be created by the administrator or by the maildir owner, manually. This file lists all available sharable maildirs that this maildir can access in shared mode (confused yet?). This file contains one or more lines of the following format:

name /path/to/shared/maildir

"name" is an arbitrary name that's given to this collection of shared folders. The name may not contain slashes, periods, or spaces. This is followed by a pathname to the maildir containing shared folders. Note that this is NOT the sharable folder itself, but the maildir that contains one or more sharable folders. The maildir client will be able to selectively subscribe to any sharable folder in that maildir.

shared-folders

This subdirectory forms the root of all the shared folders that are subscribed to. Let's say that shared-maildirs has the following contents:

firmwide /home/bigcheese/Maildir-shared
tech /home/gearhead/Maildir-shared

Subscribing to folders 'golf' and 'boat' in bigcheese's shared Maildir, and to the folder 'maintenance' in gearhead's shared Maildir involves creating the following subdirectories: shared-folders/firmwide/.golf, shared-folders/firmwide/.boat, and shared-folders/tech/.maintenance.

shared

This is a soft link that's automatically created in shared-folder/name. It is a soft link that points to the sharable maildir, which contains the sharable folders.

Subscribing to a shared folder

Unsubscribing

Opening a shared folder

The process of "opening" a shared folder involves basically "syncing" the contents of shared-folder/name/.foldername with the contents of the sharable folder in the original sharable maildir.