Hubbry Logo
search
logo
Maildir
Maildir
current hub
2306166

Maildir

logo
Community Hub0 Subscribers
Write something...
Be the first to start a discussion here.
Be the first to start a discussion here.
See all
Maildir

The Maildir e-mail format is a common way of storing email messages on a file system, rather than in a database. Each message is assigned a file with a unique name, and each mail folder is a file system directory containing these files. Maildir was designed by Daniel J. Bernstein circa 1995, with a major goal of eliminating the need for program code to handle file locking and unlocking through use of the local filesystem. Maildir design reflects the fact that the only operations valid for an email message is that it be created, deleted or have its status changed in some way.

A Maildir directory (often named Maildir) usually has three subdirectories named tmp, new, and cur.

Sam Varshavchik, the author of the Courier Mail Server and other software, defined the Maildir++ extension to the Maildir format to support subfolders and mail quotas. Maildir++ directories contain subdirectories with names that start with a '.' (dot) which are also Maildir++ folders. The extension complies with the original Maildir specification, which allows for subdirectories in addition to tmp, new and cur.

A mail delivery agent is a program that delivers an email message into a Maildir. The mail delivery agent creates a new file with a unique filename in the tmp directory. At the time of its invention guaranteeing unique filenames efficiently was difficult. The original qmail algorithm for unique names was:

By 2000, the qmail author recommended in an updated specification to append the value of a per-process counter to the PID, whose value should be incremented after each delivery. The rate-limiting recommendation to "wait two seconds" was dropped.

By 2003, the recommendations had been further amended to require that instead of the PID and counter, the middle part of the filename should be created by "concatenating enough of the following strings to guarantee uniqueness" even in the face of multiple simultaneous deliveries to the same maildir from one or more processes:

This 2003 algorithm was criticised in 2006 as being unnecessarily complex by Timo Sirainen, the creator of Dovecot.

As of November 2023, qmail author Daniel Bernstein had made no further changes to the 2003 filename generation recommendations. On modern POSIX systems, temporary files can be safely created with the mkstemp C library function.

See all
User Avatar
No comments yet.