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 ...
28 ^A^A^A^A
29 ^A^A^A^A
30 From: example@example.com
31 To: example@example.org
32 Subject: test 2
33
34 bar
35 ^A^A^A^A
36
37 In contrast to most other single file mailbox formats like MBOXO and
38 MBOXRD (see mbox(5) and RFC4155) there is no need to quote/dequote
39 "From "-lines in MMDF mailboxes as such lines have no special meaning
40 in this format.
41
42 If the modification-time (usually determined via stat(2)) of a nonempty
43 mailbox file is greater than the access-time the file has new mail.
44 Many MUAs place a Status: header in each message to indicate which mes‐
45 sages have already been read.
46
48 Since MMDF files are frequently accessed by multiple programs in paral‐
49 lel, MMDF files should generally not be accessed without locking.
50
51 Three different locking mechanisms (and combinations thereof) are in
52 general use:
53
54 · fcntl(2) locking is mostly used on recent, POSIX-compliant sys‐
55 tems. Use of this locking method is, in particular, advisable if
56 MMDF files are accessed through the Network File System (NFS),
57 since it seems the only way to reliably invalidate NFS clients'
58 caches.
59
60 · flock(2) locking is mostly used on BSD-based systems.
61
62 · Dotlocking is used on all kinds of systems. In order to lock an
63 MMDF file named folder, an application first creates a temporary
64 file with a unique name in the directory in which the folder
65 resides. The application then tries to use the link(2) system
66 call to create a hard link named folder.lock to the temporary
67 file. The success of the link(2) system call should be addition‐
68 ally verified using stat(2) calls. If the link has succeeded,
69 the mail folder is considered dotlocked. The temporary file can
70 then safely be unlinked.
71
72 In order to release the lock, an application just unlinks the
73 folder.lock file.
74
75 If multiple methods are combined, implementors should make sure to use
76 the non-blocking variants of the fcntl(2) and flock(2) system calls in
77 order to avoid deadlocks.
78
79 If multiple methods are combined, an MMDF file must not be considered
80 to have been successfully locked before all individual locks were
81 obtained. When one of the individual locking methods fails, an applica‐
82 tion should release all locks it acquired successfully, and restart the
83 entire locking procedure from the beginning, after a suitable delay.
84
85 The locking mechanism used on a particular system is a matter of local
86 policy, and should be consistently used by all applications installed
87 on the system which access MMDF files. Failure to do so may result in
88 loss of e-mail data, and in corrupted MMDF files.
89
91 MMDF is not part of any currently supported standard.
92
94 MMDF was developed at the University of Delaware by Dave Crocker.
95
97 scomail(1), fcntl(2), flock(2), link(2), stat(2), mbox(5), RFC4155,
98 RFC5322
99
100
102 Urs Janssen <urs@tin.org>
103
104
105
106Unix November 5th, 2013 mmdf(5)