maildir — E-mail directory
$HOME/Maildir
A “Maildir” is a structured directory that holds E-mail messages. Maildirs were first implemented by the Qmail mail server. Qmail's maildirs were a simple data structure, nothing more than a single collection of E-mail messages. Courier builds upon Qmail's maildirs to provide extended functionality, such as folders and quotas. This document describes Courier's extended maildirs, without explicitly identifying Courier-specific extensions. See maildir(5) in Qmail's documentation for the original definition of maildirs.
Traditionally, E-mail folders were saved as plain text files, called “mboxes”. Mboxes have known limitations. Only one application can use an mbox at the same time. Locking is required in order to allow simultaneous concurrent access by different applications. Locking is often problematic, and not very reliable in network-based filesystem requirements. Some network-based filesystems don't offer any reliable locking mechanism at all. Furthermore, even bulletproof locking won't prevent occasional mbox corruption. A process can be killed or terminated in the middle of updating an mbox. This will likely result in corruption, and a loss of most messages in the mbox.
Maildirs allow multiple concurrent access by different applications. Maildirs do not require locking. Multiple applications can update a maildir at the same time, without stepping on each other's feet.
A “maildir” is a directory that's created by
maildirmake(1).
Naturally, maildirs should not have any group or world permissions,
unless you want other people to read your mail.
A maildir contains three subdirectories:
tmp, new, and
cur.
These three subdirectories comprise the primary folder, where new mail
is delivered by the system.
Folders are
additional subdirectories in the maildir
whose names begin with a period: such as
.Drafts or .Sent.
Each folder itself contains the
same three subdirectories, tmp, new,
and cur,
and an additional zero-length file named
maildirfolder, whose purpose is to inform any mail
delivery agent that it's really delivering to a folder, and that
the mail delivery agent should look in the parent directory for
any maildir-related information.
Folders are not physically nested.
A folder subdirectory,
such as .Sent
does not itself contain any subfolders.
The main maildir contains a single, flat list of subfolders.
These folders are logically nested,
and periods serve to separate folder hierarchies.
For example, .Sent.2002 is considered to be a subfolder
called “2002” which is a subfolder of “Sent”.
Folder names can contain any Unicode character, except for control characters. US-ASCII characters, U+0x0020 - U+0x007F, except for the period, forward-slash, and ampersand characters (U+0x002E, U+0x002F, and U+0x0026) represent themselves. The ampersand is represent by the two character sequence “&-”. The period, forward slash, and non US-ASCII Unicode characters are represented using the UTF-7 character set, and encoded with a modified form of base64-encoding.
The “&” character starts the modified base64-encoded sequence; the sequence is terminated by the “-” character. The sequence of 16-bit Unicode characters is written in big-endian order, and encoded using the base64-encoding method described in section 5.2 ote"le">
cc $DEFAULT
xfilter "reformail -r -t"
/^To:.*/
getaddr($MATCH) =~ /^.*/;
MATCH=tolower($MATCH)
flock "vacation.lock" {
current_time=time;
if (gdbmopen("vacation.dat", "C") == 0)
{
if ( (prev_time=gdbmfetch($MATCH)) ne "" && \
$prev_time >= $current_time - 60 * 60 * 24 * 7)
{
exit
}
gdbmstore($MATCH, $current_time)
gdbmclose
}
}
to "| ( cat - ; echo ''; cat vacation.msg) | $SENDMAIL"
This script requires that maildrop must be compiled with GDBM support enabled, which is done by default if GDBM libraries are present.
After you return from vacation, you can use a simple Perl script to obtain a list of everyone who sent you mail (of course, that can also be determined by examining your mailbox).