GNU Mailutils |
|
General-Purpose Mail Package |
Official GNU Software |
mailbox
Statementmailbox { # Use specified url as a mailspool. mail-spool url; # Create mailbox url using pattern. mailbox-pattern pattern; # Default mailbox type. mailbox-type type; # Default user mail folder. folder dir; }
The mailbox
statement configures the location, name and type of
user mailboxes.
The mailbox location can be specified using mail-spool
or
mail-pattern
statements.
The mail-spool
statement specifies directory that holds user
mailboxes. Once this statement is given, the libmailutils
library will assume that the mailbox of user login is kept in
file path/login.
Historically, path can contain mailbox type prefix, e.g.:
‘maildir:///var/spool/mail’, but such usage is discouraged in
favor of mailbox-pattern
statement.
The mailbox-pattern
statement is a preferred way of configuring
mailbox locations. It supersedes mail-spool
statement.
The url must be a valid mailbox URL (see Mailbox), which may contain references to the ‘user’ variable (see Variables). This variable will be expanded to the actual user name.
Optional URL parameters can be used to configure indexed directory structure. Such structure is a special way of storing mailboxes, which allows for faster access in case of very large number of users.
By default, all user mailboxes are stored in a single directory and are named after user login names. To find the mailbox for a given user, the system scans the directory for the corresponding file. This usually implies linear search, so the time needed to locate a mailbox is directly proportional to the ordinal number of the mailbox in the directory.
GNU Mailutils supports three types of indexed directories: ‘direct’, ‘reverse’, and ‘hashed’.
In direct indexed directory structure, path contains 26 subdirectories named with lower-case letters of Latin alphabet. The location of the user mailbox is determined using the following algorithm:
For example, using this algorithm, the mailbox of the user ‘smith’ is stored in file path/s/smith.
If each of single-letter subdirectories contains the indexed directory structure, we have second level of indexing. In this case the file name of ‘smith’’s mailbox is path/s/m/smith.
The reverse indexed structure uses the same principles, but the indexing letters are taken from the end of the user name, instead of from the beginning. For example, in the 2nd level reverse indexed structure, the ‘smith’’s mailbox is located in path/h/t/smith.
Finally, the hashed structure consists of 256 subdirectories under path, named by 2-letter hex codes from ‘00’ to ‘FF’. Mailboxes are stored in these subdirectories. The name of the subdirectory is computed by hashing first level letters of the user name. The hashing algorithm is:
Indexed directory structures are configured using the following arguments:
Specifies the type of indexing. Valid values are ‘index’, for direct indexed structure, ‘rev-index’ for reverse indexing, and ‘hash’ for hashed structure.
Specifies indexing level.
Specifies indexing key. The only meaningful value, as of Mailutils version 3.14 is ‘user=${user}’.
Let’s assume the traditional mail layout, in which incoming
mails are stored in a UNIX mailbox named after the recipient user name
and located in /var/mail directory.
The mailbox-pattern
for this case is:
mailbox-pattern "/var/mail/${user}";
It is entirely equivalent to specifying ‘mail-spool "/var/mail"’.
Now, if the layout is the same, but mailboxes are kept in ‘maildir’ format, then the corresponding statement is:
mailbox-pattern "maildir:///var/mail/${user}";
Finally, if the mailboxes are stored in a directly-indexed directory with two levels of indexing, the URL is:
mailbox-pattern "maildir:///var/mail;type=index;param=2;user=${user}";
If neither mailbox-pattern
nor mail-spool
are given, the
mailbox names are determined using the following algorithm:
FOLDER
is set, use its value.
MAIL
is set, use its
value.
The built-in mail spool directory name is determined at compile time, using the ‘_PATH_MAILDIR’ define from the include file paths.h. If this value is not defined, /var/mail or /usr/spool/mail is used.
Specifies the type of mailboxes. By default, ‘mbox’ (UNIX mailbox)
is assumed. This can be changed while configuring the package by
setting MU_DEFAULT_SCHEME
configuration variable. The default
value can be verified by running mailutils info scheme
.
Sets user mail folder directory. Its value is used when expanding ‘plus-notation’, i.e. such mailbox names as +inbox. The ‘+’ sign is replaced by dir, followed by a directory separator (‘/’).
The dir argument can contain mailbox type prefix, e.g ‘mh://Mail’.
The default folder name is ‘Mail/’.
This document was generated on January 2, 2022 using makeinfo.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.