1mmdf(5) User Manuals mmdf(5)
2
3
4
6 MMDF - Multi-channel Memorandum Distribution Facility mailbox format
7
9 This document describes the MMDF mailbox format used by some MTAs and
10 MUAs (i.e. scomail(1)) to store mail messages locally.
11
12 An MMDF mailbox is a text file containing an arbitrary number of e-mail
13 messages. Each message consists of a postmark, followed by an e-mail
14 message formatted according to RFC5322, followed by a postmark. The
15 file format is line-oriented. Lines are separated by line feed charac‐
16 ters (ASCII 10). A postmark line consists of the four characters
17 "^A^A^A^A" (Control-A; ASCII 1).
18
19 Example of a MMDF mailbox holding two mails:
20
21 ^A^A^A^A
22 From: example@example.com
23 To: example@example.org
24 Subject: test
25
26 From what I learned about the MMDF-format:
27 ^A^A^A^A
28 ^A^A^A^A
29 From: example@example.com
30 To: example@example.org
31 Subject: test 2
32
33 bar
34 ^A^A^A^A
35
36 In contrast to most other single file mailbox formats like MBOXO and
37 MBOXRD (see mbox(5) and RFC4155) there is no need to quote/dequote
38 "From "-lines in MMDF mailboxes as such lines have no special meaning
39 in this format.
40
41 If the modification-time (usually determined via stat(2)) of a nonempty
42 mailbox file is greater than the access-time the file has new mail.
43 Many MUAs place a Status: header in each message to indicate which mes‐
44 sages have already been read.
45
47 Since MMDF files are frequently accessed by multiple programs in paral‐
48 lel, MMDF files should generally not be accessed without locking.
49
50 Three different locking mechanisms (and combinations thereof) are in
51 general use:
52
53 · fcntl(2) locking is mostly used on recent, POSIX-compliant sys‐
54 tems. Use of this locking method is, in particular, advisable if
55 MMDF files are accessed through the Network File System (NFS),
56 since it seems the only way to reliably invalidate NFS clients'
57 caches.
58
59 · flock(2) locking is mostly used on BSD-based systems.
60
61 · Dotlocking is used on all kinds of systems. In order to lock an
62 MMDF file named folder, an application first creates a temporary
63 file with a unique name in the directory in which the folder
64 resides. The application then tries to use the link(2) system
65 call to create a hard link named folder.lock to the temporary
66 file. The success of the link(2) system call should be addition‐
67 ally verified using stat(2) calls. If the link has succeeded,
68 the mail folder is considered dotlocked. The temporary file can
69 then safely be unlinked.
70
71 In order to release the lock, an application just unlinks the
72 folder.lock file.
73
74 If multiple methods are combined, implementors should make sure to use
75 the non-blocking variants of the fcntl(2) and flock(2) system calls in
76 order to avoid deadlocks.
77
78 If multiple methods are combined, an MMDF file must not be considered
79 to have been successfully locked before all individual locks were
80 obtained. When one of the individual locking methods fails, an applica‐
81 tion should release all locks it acquired successfully, and restart the
82 entire locking procedure from the beginning, after a suitable delay.
83
84 The locking mechanism used on a particular system is a matter of local
85 policy, and should be consistently used by all applications installed
86 on the system which access MMDF files. Failure to do so may result in
87 loss of e-mail data, and in corrupted MMDF files.
88
90 MMDF is not part of any currently supported standard.
91
93 MMDF was developed at the University of Delaware by Dave Crocker.
94
96 scomail(1), fcntl(2), flock(2), link(2), stat(2), mbox(5), RFC4155,
97 RFC5322
98
99
101 Urs Janssen <urs@tin.org>
102
103
104
105Unix November 5th, 2013 mmdf(5)