table of contents
MAILDIRMAKE(1) | Double Precision, Inc. | MAILDIRMAKE(1) |
NAME¶
maildirmake - create maildirs and maildir folders
SYNOPSIS¶
maildirmake [options...] {maildir}
DESCRIPTION¶
The maildirmake command creates maildirs, and maildir folders and performs some routine maintenance on them. This documentation describes the maildirmake command from the Courier mail server, which creates an extended form of maildirs that implements additional extensions beyond the basic maildir properties that were first implemented in the Qmail mail server.
OPTIONS¶
-S
-q quota
####S
####C
-f folder
-F folder
-s mode
--add name=pathname, --del name
--checkutf8 maildir maildirfilter
--convutf8 maildir maildirfilter
FOLDERS¶
This maildirmake command supports enhanced maildirs that contain folders.
By itself, maildirmake makes a new subdirectory maildir, and creates all the necessary structures. The -f option creates a new "folder" within an existing maildir. maildir must already exist, and the maildirmake command will create a new folder in the maildir.
Folders are simply subdirectories inside the main maildir whose names start with a period, and which are themselves maildirs. For example, the command "maildirmake -f Drafts mail/Maildir" creates mail/Maildir/.Drafts, that has the usual tmp, new and cur. You MUST use the -f option, instead of specifying mail/Maildir/.Drafts directly, in order to correctly initialize certain enhanced maildir features.
Folders cannot be created directly within other folders. Running maildirmake -f Urgent mail/Maildir/.Drafts will not work. Instead, the period character is designated as a hierarchy separator, run maildirmake -f Drafts.Urgent mail/Maildir instead. This creates mail/Maildir/.Drafts.Urgent, and all mail software that supports enhanced maildirs will interpret it as a subfolder Urgent of the Drafts folder.
SHARED FOLDERS¶
This is another extension to the Maildir format that allows folders to be shared between multiple clients.
Note
The Courier IMAP server implements two types of shared folders: filesystem permission-based shared folders, as well as virtual shared folders based on IMAP access control lists. Use the maildirmake command to implement shared folders based on filesystem permissions. The maildiracl(1)[2] command manages access control lists, which are used by virtual shared folders.
See the Courier IMAP server documentation for more information.
First, you need to create a collection of sharable folders, as a separate maildir:
maildirmake -S /usr/local/share/maildirs/notices
Then, create individuals folders that will be accessed in shared mode:
maildirmake -s write -f Weekly /usr/local/share/maildirs/notices
In this example, the "Weekly" folder is created, with read/write access to everyone. Multiple folders can be created in the same maildir, with different access permissions. Everyone can create a sharable maildir. The access privileges for individual folders are set by the -s option, and are implemented using traditional filesystem permissions.
Use the --add and --del options to add a sharable maildir to an existing maildir. Client software that implements this extension will now know where to find sharable folders:
maildirmake --add notices=/usr/local/share/maildirs/notices $HOME/Maildir
$HOME/Maildir is your main maildir. The argument to -add is nick=path. nick is a nickname for this collection of sharable folders, and path is the location of the sharable maildir. All folders in the sharable maildir that you have access to -- such as "Weekly", in this case, will now be accessible. Multiple sharable maildirs can be added, by giving each one a unique nick.
The --del option "disconnects" the sharable maildir from the main maildir.
GLOBAL SHARED FOLDERS¶
Normally -add command must be run for every maildir which needs to access the sharable maildir. Alternatively the file /etc/courier/maildirshared can be created, to specify a default set of sharable maildirs. Each line in this file takes the following format:
nick<tab>path
nick is a short nickname for the sharable maildir, <tab> is a single tab character, path is the pathname to the sharable maildir.
ACCESSING SHARED FOLDERS¶
You may have read or write access to a shared folder. If you have write access, you can add messages to the shared folder. You can also delete messages that you've added.
Anyone can create a sharable maildir, so if the sharable maildir is actually created by you, can can delete any message, not just your own.
CONVERTING PRE-UNICODE FORMAT MAILDIRS¶
This section is relevant to:
These versions have been updated to implement native Unicode support in several E-mail-related protocols. It is already expected that updating Internet standards to use native Unicode-formatted E-mail messages will not be 100% backwards-compatible, in terms of E-mail client support. Given that, this major update to Unicode will also introduce some backwards-incompatible changes to the internal structure of maildirs, as a major upgrade to simplify Unicode support going forward. Might as well go through the pain of a major upgrade once.
maildirmake's --checkutf8 and --convutf8 options are tools to aid in conversion of existing mailboxes to the new Unicode-based naming standard.
Background¶
Mail folders in a maildir are hidden subdirectories. For example: a folder name “Mailing list” is a maildir subdirectory named $HOME/Maildir/.Mailing list ($HOME/Maildir is the main mailbox).
Prior to the unicode update, non-English characters in folder names used a convention based on the non-standard “modified-UTF7” encoding used by IMAP. A folder named “Résumé” is a maildir subdirectory named $HOME/Maildir/.R&AOk-sum&AOk-. The current versions of Courier, Courier-IMAP, and SqWebmail, now creates $HOME/Maildir/.Résumé using the UTF8 encoding. This appears as plain “.Résumé” (hidden) subdirectory on modern UTF8-based systems.
Consequently, any existing maildirs with folders that use non-English names must be converted as part of updating to the current version of Courier, Courier-IMAP, and SqWebmail from pre-unicode versions. This does not happen automatically when updating to the current version. This must be done manually given the wide variety of individual mail server configurations that are possible.
Unicode conversion overview¶
Updating from pre-unicode versions involves:
Unicode conversion steps¶
The --checkutf8 and --convutf8 options to maildirmake convert a single maildir to the new unicode format:
$ ./maildirmake --checkutf8 ~/Maildir ~/.mailfilter Checking /home/mrsam/Maildir: Mail filter to INBOX.R&AOk-sum&AOk- updated to INBOX.Résumé Subscription to INBOX.R&AOk-sum&AOk- changed to INBOX.Résumé Rename INBOX.R&AOk-sum&AOk- to INBOX.Résumé Verified /home/mrsam/Maildir/courierimapsubscribed Verified /home/mrsam/.mailfilter $ ./maildirmake --convutf8 ~/Maildir ~/.mailfilter Checking /home/mrsam/Maildir: Mail filter to INBOX.R&AOk-sum&AOk- updated to INBOX.Résumé Subscription to INBOX.R&AOk-sum&AOk- changed to INBOX.Résumé Rename INBOX.R&AOk-sum&AOk- to INBOX.Résumé Updating /home/mrsam/Maildir/courierimapsubscribed Updating /home/mrsam/.mailfilter
--checkutf8 goes through the motions of converting a single maildir to Unicode, but without making any actual changes. --convutf8 does the conversion for real. The first required parameter is the maildir to convert. The second parameter is optional, and specifies the corresponding maildrop filtering recipe, but only if SqWebMail generates the mail filtering recipes. SqWebMail's mail filtering recipes are parsable, and can be automatically-converted. Non-SqWebMail-generated .mailfilters cannot be converted automatically. The second parameter must be omitted, and the mail filtering recipe must be converted by hand.
Note
All this work is only needed if maildirs have folders with non-English names. Ignore everything you've just read if all folder names are English-only. --checkutf8 and --convutf8 will not do anything, and nothing needs to be done.
To convert all mailboxes to Unicode all at once:
It is safe to run --checkutf8 without shutting down your mail server. A non-zero exit from --checkutf8 indicates a problem (see below) for a particular maildir.
Note
--convutf8 is a one-shot deal. Do not run --convutf8 a second time after it successfully converted a maildir. In nearly all cases nothing will happen, but there are rare edge cases where some folder names may get garbled, or it fails completely.
Resolving unicode conversion problems¶
The only likely problems that might be encountered is the fall-out from buggy IMAP clients that did not follow the pre-Unicode naming convention for non-Latin folder names. The customized IMAP “modified-UTF7” encoding convention for non-Latin folder names is mostly an IMAP client convention, and the pre-Unicode version of Courier-IMAP did not enforce it. The server took the name from the IMAP client, as is.
Unicode conversion (--checkutf8 or --convutf8) fails if it finds a folder name that does not correctly use IMAP's “modified-UTF7” encoding. This can only be resolved manually, by renaming the folder. This may also involve manually editing courierimapsubscribed and .mailfilter if they exist. The bad folder name should be removed from courierimapsubscribed. For .mailfilter it is sufficient to remove only the comments that precede the actual maildrop rule, and --convutf8 will remove the entire rule, by itself. --convutf8 actually reads only the machine-parsable comments in SqWebMail-generated .mailfilter (plus a few other things in the file), and replaces the .mailfilter with the Unicode version based solely on the parsed data.
After the Unicode conversion¶
The current, Unicode version of Courier-IMAP supports both Unicode and non-Unicode IMAP clients; however unlike the pre-Unicode version, Courier-IMAP rejects requests from non-Unicode IMAP clients to use or create folders that are not properly encoded.
Encountering a bad folder during conversion strongly suggests the presence of an IMAP client that does not correctly encode non-English folder names. Such an IMAP client will likely have problems after the conversion.
SEE ALSO¶
maildir(5)[3], maildiracl(1)[2], maildirkw(1)[4], maildirwatch(1)[5], maildrop(1)[6], maildirquota(7)[1], deliverquota(8)[7], maildropfilter(7)[8].
AUTHOR¶
Sam Varshavchik
NOTES¶
- 1.
- maildirquota(7)
- 3.
- maildir(5)
- 4.
- maildirkw(1)
- 5.
- maildirwatch(1)
- 6.
- maildrop(1)
- 8.
- maildropfilter(7)
04/14/2022 | Courier Mail Server |