Movatterモバイル変換


[0]ホーム

URL:


D. J. Bernstein
Internet mail

Using maildir format

Why should I use maildir?

Two words:no locks.An MUA can read and delete messages while new mail is being delivered:each message is stored in a separate file with a unique name,so it isn't affected by operations on other messages.An MUA doesn't have to worry about partially delivered mail:each message is safely written to disk in thetmp subdirectorybefore it is moved tonew.The maildir format is reliable even over NFS.

How are unique names created?

Unless you're writing messages to a maildir,the format of a unique name is none of your business.A unique name can be anythingthat doesn't contain a colon (or slash)and doesn't start with a dot.Do not try to extract information from unique names.

Okay, so you're writing messages.A unique name has three pieces, separated by dots.On the left is the result of time() or the second counter from gettimeofday().On the right is the result of gethostname().(To deal with invalid host names,replace / with \057 and : with \072.)In the middle is a delivery identifier, discussed below.

As the terminology suggests,every delivery to this maildir must have its own unique name.When a maildir is shared through NFS,every machine that delivers to the maildirmust have its own hostname.Within one machine,every delivery within the same secondmust have a different delivery identifier.

Modern delivery identifiers are created by concatenatingenough of the following strings to guarantee uniqueness:

Old-fashioned delivery identifiers use the following formats:

What can I put in info?

When you move a file fromnew tocur,you have to change its name fromuniq touniq:info.Make sure to preserve theuniq string,so that separate messages can't bump into each other.

info is morally equivalent to the Status field used by mbox readers.It'd be useful to have MUAs agree on the meaning ofinfo,so I'm keeping a list ofinfo semantics.Here it is.

info starting with "1,": Experimental semantics.

info starting with "2,":Each character after the comma is an independent flag.

New flags may be defined later.Flags must be stored in ASCII order: e.g., "2,FRS".

Can a maildir contain more than tmp, new, cur?

Yes:
[8]ページ先頭

©2009-2026 Movatter.jp