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