'\" t .\" .\" .\" Title: maildirmake .\" Author: Sam Varshavchik .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 03/01/2021 .\" Manual: Double Precision, Inc. .\" Source: Courier Mail Server .\" Language: English .\" .TH "MAILDIRMAKE" "1" "03/01/2021" "Courier Mail Server" "Double Precision, Inc\&." .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" maildirmake \- create maildirs and maildir folders .SH "SYNOPSIS" .HP \w'\fBmaildirmake\fR\ 'u \fBmaildirmake\fR [options...] {\fImaildir\fR} .SH "DESCRIPTION" .PP The \fBmaildirmake\fR command creates maildirs, and maildir folders and performs some routine maintenance on them\&. This documentation describes the \fBmaildirmake\fR 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\&. .SH "OPTIONS" .PP \-S .RS 4 create a "sharable" maildir\&. A sharable maildir has slightly different permissions which allows creation of publicly\-shared folders\&. .RE .PP \-q \fIquota\fR .RS 4 install a quota on the maildir\&. See \m[blue]\fB\fBmaildirquota\fR(7)\fR\m[]\&\s-2\u[1]\d\s+2 for more information\&. The specified maildir gets automatically created if it does not exist; otherwise the existing maildir\*(Aqs quota gets updated\&. .RE .PP \-f \fIfolder\fR .RS 4 do not create a maildir, but create a folder in an existing maildir\&. .RE .PP \-F \fIfolder\fR .RS 4 Like the \-f option, except that the folder\*(Aqs name is given using the system locale\*(Aqs character set\&. Non\-Latin characters in the folder\*(Aqs name must be given to the \-f option using IMAP\*(Aqs UTF8 encoding\&. The \-F option takes the folder name specified using the console\*(Aqs character set\&. .RE .PP \-s \fImode\fR .RS 4 create a publicly accessible folder in an existing sharable maildir\&. First, use the \fB\-S\fR option to create a sharable maildir\&. Then, run \fBmaildirmake\fR again with the \fB\-s\fR option to create publicly accessible folders\&. \fImode\fR is a comma\-separated list of the following keywords: read \- readonly folder, only you can write messages to this folder; write \- anyone can read and write messages to this folder; group \- only allow members of your own system group to access messages in this folder (instead of everyone)\&. .RE .PP \-\-add \fIname\fR=\fIpathname\fR, \-\-del \fIname\fR .RS 4 create or delete the directories and links needed to access shared folders\&. See below for more information\&. .RE .PP \-\-checkutf8 \fImaildir\fR \fImaildirfilter\fR .RS 4 Perform a sanity check to verify that a pre\-unicode format maildir can be converted to a unicode\-format maildir\&. See \(lqConverting pre\-unicode format maildirs\(rq, below, for more information\&. .RE .PP \-\-convutf8 \fImaildir\fR \fImaildirfilter\fR .RS 4 Convert a pre\-unicode format maildir can be converted to a unicode\-format maildir\&. See \(lqConverting pre\-unicode format maildirs\(rq, below, for more information\&. .RE .SS "FOLDERS" .PP This \fBmaildirmake\fR command supports enhanced maildirs that contain folders\&. .PP By itself, \fBmaildirmake\fR makes a new subdirectory \fImaildir\fR, and creates all the necessary structures\&. The \fB\-f\fR option creates a new "folder" within an existing \fImaildir\fR\&. \fImaildir\fR must already exist, and the \fBmaildirmake\fR command will create a new folder in the maildir\&. .PP Folders are simply subdirectories inside the main maildir whose names start with a period, and which are themselves maildirs\&. For example, the command "\fBmaildirmake \-f Drafts mail/Maildir\fR" creates mail/Maildir/\&.Drafts, that has the usual tmp, new and cur\&. You MUST use the \fB\-f\fR option, instead of specifying mail/Maildir/\&.Drafts directly, in order to correctly initialize certain enhanced maildir features\&. .PP Folders cannot be created directly within other folders\&. Running \fBmaildirmake \-f Urgent mail/Maildir/\&.Drafts\fR will not work\&. Instead, the period character is designated as a hierarchy separator, run \fBmaildirmake \-f Drafts\&.Urgent mail/Maildir\fR 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\&. .SS "SHARED FOLDERS" .PP This is another extension to the Maildir format that allows folders to be shared between multiple clients\&. .if n \{\ .sp .\} .RS 4 .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBNote\fR .ps -1 .br .PP 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 \fBmaildirmake\fR command to implement shared folders based on filesystem permissions\&. The \m[blue]\fB\fBmaildiracl\fR(1)\fR\m[]\&\s-2\u[2]\d\s+2 command manages access control lists, which are used by virtual shared folders\&. .PP See the Courier IMAP server documentation for more information\&. .sp .5v .RE .PP First, you need to create a collection of sharable folders, as a separate maildir: .sp .if n \{\ .RS 4 .\} .nf \fBmaildirmake \-S /usr/local/share/maildirs/notices\fR .fi .if n \{\ .RE .\} .PP Then, create individuals folders that will be accessed in shared mode: .sp .if n \{\ .RS 4 .\} .nf \fBmaildirmake \-s write \-f Weekly /usr/local/share/maildirs/notices\fR .fi .if n \{\ .RE .\} .PP 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 \fB\-s\fR option, and are implemented using traditional filesystem permissions\&. .PP Use the \fB\-\-add\fR and \fB\-\-del\fR options to add a sharable maildir to an existing maildir\&. Client software that implements this extension will now know where to find sharable folders: .sp .if n \{\ .RS 4 .\} .nf \fBmaildirmake \-\-add notices=/usr/local/share/maildirs/notices $HOME/Maildir\fR .fi .if n \{\ .RE .\} .PP $HOME/Maildir is your main maildir\&. The argument to \fB\-add\fR is \fInick\fR=\fIpath\fR\&. \fInick\fR is a nickname for this collection of sharable folders, and \fIpath\fR 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 \fInick\fR\&. .PP The \fB\-\-del\fR option "disconnects" the sharable maildir from the main maildir\&. .SS "GLOBAL SHARED FOLDERS" .PP Normally \fB\-add\fR 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: .sp .if n \{\ .RS 4 .\} .nf \fInick\fR\fIpath\fR .fi .if n \{\ .RE .\} .PP \fInick\fR is a short nickname for the sharable maildir, is a single tab character, \fIpath\fR is the pathname to the sharable maildir\&. .SS "ACCESSING SHARED FOLDERS" .PP 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\*(Aqve added\&. .PP 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\&. .SH "CONVERTING PRE\-UNICODE FORMAT MAILDIRS" .PP This section is relevant to: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Updating Courier\-IMAP to version 5\&.0, and later, from prior versions of Courier\-IMAP, or: .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Updating SqWebmail to version 6\&.0, and later, from prior versions of SqWebmail, or: .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Updating Courier to version 1\&.0, and later, from prior versions of Courier\&. .RE .PP 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\&. .PP \fBmaildirmake\fR\*(Aqs \fB\-\-checkutf8\fR and \fB\-\-convutf8\fR options are tools to aid in conversion of existing mailboxes to the new Unicode\-based naming standard\&. .SS "Background" .PP Mail folders in a maildir are hidden subdirectories\&. For example: a folder name \(lqMailing list\(rq is a maildir subdirectory named $HOME/Maildir/\&.Mailing list ($HOME/Maildir is the main mailbox)\&. .PP Prior to the unicode update, non\-English characters in folder names used a convention based on the non\-standard \(lqmodified\-UTF7\(rq encoding used by IMAP\&. A folder named \(lqRésumé\(rq 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 \(lq\&.Résumé\(rq (hidden) subdirectory on modern UTF8\-based systems\&. .PP 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\&. .SS "Unicode conversion overview" .PP Updating from pre\-unicode versions involves: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Renaming the actual maildir folders, $HOME/Maildir/\&.\fInames\fR into unicode names (using UTF8)\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Updating the $HOME/Maildir/courierimapsubscribed file, which is a list of subscribed IMAP folders, if it exists\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Updating any maildrop mail filtering recipes, $HOME/\&.mailfilter, if it exists, to reference the unicode maildir folders; or updating any custom site mail filtering engine that delivers to maildir folders, to reference the correct subdirectory names\&. .RE .SS "Unicode conversion steps" .PP The \fB\-\-checkutf8\fR and \fB\-\-convutf8\fR options to \fBmaildirmake\fR convert a single maildir to the new unicode format: .sp .if n \{\ .RS 4 .\} .nf $ \&./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 .fi .if n \{\ .RE .\} .PP \fB\-\-checkutf8\fR goes through the motions of converting a single maildir to Unicode, but without making any actual changes\&. \fB\-\-convutf8\fR does the conversion for real\&. The first required parameter is the maildir to convert\&. The second parameter is optional, and specifies the corresponding \fBmaildrop\fR filtering recipe, \fIbut only if \fR\fISqWebMail\fR generates the mail filtering recipes\&. SqWebMail\*(Aqs 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\&. .if n \{\ .sp .\} .RS 4 .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBNote\fR .ps -1 .br .PP All this work is only needed if maildirs have folders with non\-English names\&. Ignore everything you\*(Aqve just read if all folder names are English\-only\&. \fB\-\-checkutf8\fR and \fB\-\-convutf8\fR will not do anything, and nothing needs to be done\&. .sp .5v .RE .PP To convert all mailboxes to Unicode all at once: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} A shell script needs to run the \fB\-\-checkutf8\fR option for every mailbox\&. A list of all accounts\*(Aq maildirs needs to be prepared in advance, together with the corresponding \&.mailfilters (where appropriate)\&. courier\-authlib\*(Aqs \fBauthenumerate\fR command is usually a good starting point\&. It\*(Aqs ok to explicitly specify each mailbox\*(Aqs \&.mailfilter, when using SqWebMail even if a particular mailbox does not use it\&. It will be ignored\&. The list of all accounts\*(Aq maildirs gets converted to a shell script that runs \fBmaildirmake\fR with the \fB\-\-checkutf8\fR option\&. The script should report any maildir whose \fB\-\-checkutf8\fR option reports an error, and \fBmaildirmake\fR exits with a non\-zero status\&. .sp It is safe to run \fB\-\-checkutf8\fR without shutting down your mail server\&. A non\-zero exit from \fB\-\-checkutf8\fR indicates a problem (see below) for a particular maildir\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Once \fB\-\-checkutf8\fR does not find any problems with any mailbox, shut down the mail server, run \fB\-\-checkutf8\fR one more time for all mailboxes, then if everything goes well, upgrade Courier, Courier\-IMAP, or SqWebMail and run \fB\-\-convutf8\fR on every mailbox before restarting the server\&. .RE .if n \{\ .sp .\} .RS 4 .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBNote\fR .ps -1 .br .PP \fB\-\-convutf8\fR is a one\-shot deal\&. Do not run \fB\-\-convutf8\fR 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\&. .sp .5v .RE .SS "Resolving unicode conversion problems" .PP 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 \(lqmodified\-UTF7\(rq 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\&. .PP Unicode conversion (\fB\-\-checkutf8\fR or \fB\-\-convutf8\fR) fails if it finds a folder name that does not correctly use IMAP\*(Aqs \(lqmodified\-UTF7\(rq 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 \fBmaildrop\fR rule, and \fB\-\-convutf8\fR will remove the entire rule, by itself\&. \fB\-\-convutf8\fR actually reads only the machine\-parsable comments in \fBSqWebMail\fR\-generated \&.mailfilter (plus a few other things in the file), and replaces the \&.mailfilter with the Unicode version based solely on the parsed data\&. .SS "After the Unicode conversion" .PP 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\&. .PP 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\&. .SH "SEE ALSO" .PP \m[blue]\fB\fBmaildir\fR(5)\fR\m[]\&\s-2\u[3]\d\s+2, \m[blue]\fB\fBmaildiracl\fR(1)\fR\m[]\&\s-2\u[2]\d\s+2, \m[blue]\fB\fBmaildirkw\fR(1)\fR\m[]\&\s-2\u[4]\d\s+2, \m[blue]\fB\fBmaildrop\fR(1)\fR\m[]\&\s-2\u[5]\d\s+2, \m[blue]\fB\fBmaildirquota\fR(7)\fR\m[]\&\s-2\u[1]\d\s+2, \m[blue]\fB\fBdeliverquota\fR(8)\fR\m[]\&\s-2\u[6]\d\s+2, \m[blue]\fB\fBmaildropfilter\fR(7)\fR\m[]\&\s-2\u[7]\d\s+2\&. .SH "AUTHOR" .PP \fBSam Varshavchik\fR .RS 4 Author .RE .SH "NOTES" .IP " 1." 4 \fBmaildirquota\fR(7) .RS 4 \%http://www.courier-mta.org/maildirquota.html .RE .IP " 2." 4 \fBmaildiracl\fR(1) .RS 4 \%http://www.courier-mta.org/maildiracl.html .RE .IP " 3." 4 \fBmaildir\fR(5) .RS 4 \%http://www.courier-mta.org/maildir.html .RE .IP " 4." 4 \fBmaildirkw\fR(1) .RS 4 \%http://www.courier-mta.org/maildirkw.html .RE .IP " 5." 4 \fBmaildrop\fR(1) .RS 4 \%http://www.courier-mta.org/maildrop.html .RE .IP " 6." 4 \fBdeliverquota\fR(8) .RS 4 \%http://www.courier-mta.org/deliverquota.html .RE .IP " 7." 4 \fBmaildropfilter\fR(7) .RS 4 \%http://www.courier-mta.org/maildropfilter.html .RE