1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
.de Q
\\$3\*Q\\$1\*U\\$2
..
.de EX
.LD
.ft C
..
.de EE
.ft
.DE
..
.TL
mum \(en modern UNIX mail interface
.AU
John Ankarström
.SH \" -----------------------------------------------------------------
Introduction
.LP
Mum is a text-based e-mail client for UNIX and UNIX-like operating
systems that supports both plain-text and HTML e-mail.
It introduces a couple of innovations to the landscape of UNIX
e-mail clients:
.IP \h'2n'1.
Reasonable support for HTML e-mail out of the box.
.IP \h'2n'2.
A new method for local storage of e-mail, called
.I "indexed mbox" .
.IP \h'2n'3.
.I Views
\(en simple scripts that filter messages \(en instead of folders.
.LP
In this document, the fundamental concepts of mum are explained.
.SH \" -----------------------------------------------------------------
The indexed mbox format
.LP
There are two popular methods for local storage of e-mail on UNIX
systems: mbox and Maildir.
Maildir is a powerful but complicated solution, while mbox is a
simple but inefficient solution.
.PP
The
.Q "indexed mbox"
format introduced by mum builds on the traditional mbox format, but
enhances it with an additional file called an
.I index ,
which carries the same name as the mbox plus the extension
.I .i .
The index contains all headers from the mbox file, including the
.I From_
line, without the actual contents of the corresponding messages.
Further, each block of headers contains three additional headers:
.IP \h'2n'1.
.I UID ,
containing the unique identifier of the message provided by the
mail server (optional).
.IP \h'2n'2.
.I Offset ,
containing the starting position of the corresponding message in
the original mbox file, described as a byte offset.
(It is important to note that the mbox and mbox.i files are
append-only.)
.IP \h'2n'3.
.I Message-Length ,
containing the length of the entire message in the mbox file,
including both headers and body, in number of bytes.
.LP
Mum and its associated view scripts use the index for most operations.
Whenever it is time to read the actual contents of a message, the
message is retrieved from the mbox using the offset specified in
the index.
.SH \" -----------------------------------------------------------------
Retrieval methods
.LP
Being extensible by nature, mum supports a potentially infinite
number of methods for e-mail retrieval.
By default, included with mum is a script called
.I pop ,
which downloads messages from a mail server via POP3, simultaneously
creating an index for them.
The Post Office Protocol or POP is the recommended e-mail retrieval
method for mum.
.PP
If you want to save a copy of sent messages on the server, you can
use IMAP instead of POP.
The
.I imap
script, included with mum, synchronizes the mbox file with the mail
server in an intelligent way:
.IP \h'2n'a)
For any new messages in the remote INBOX folder, it downloads and
appends them to the mbox file.
.IP \h'2n'b)
For any messages in the mbox file that are sent by your own e-mail
address, it uploads them to the remote Sent folder.
.LP
The default
.I imap
script does not support any folders other than INBOX and Sent, as
mum eschews the concept of folders for scriptable views.
.PP
Additionally, mum can be used with locally stored mbox files.
The default mum distribution includes the
.I index
script, which builds an index from a pre-existing mbox file.
It supports a variety of mbox formats.
.SH \" -----------------------------------------------------------------
Views
.LP
What mum calls
.Q views
are simple scripts that filter the messages in the mbox index
according to some criteria.
The IMAP protocol, along with many e-mail clients, has a concept
of folders: incoming mail is put in the Inbox folder, outgoing mail
in the Sent folder, junk mail in the Junk folder and so forth.
In mum, views serve the same purpose: a script named
.I inbox
extracts all mail sent from e-mail addresses other than your own,
a script named
.I sent
all mail sent from your own e-mail address, a script named
.I junk
all mail with a certain header indicating that it is junk, and so
forth.
.PP
However, because views are scripts, they are much more powerful and
dynamic.
One might have a script called
.I amazon
that extracts all mail sent from Amazon, or even a script called
.I services
that extracts all mail sent from a range of companies and services.
The author of this document, for example, uses plus-addressing to
separate mail sent from different vendors.
With that assumption in mind, a
.I services
script might look like the following:
.EX
.in +5n
#!/usr/bin/perl -00 -n
print if /^Delivered-To: [^@]+\\+(amazon|apple|ebay|...)\\@/m
.EE
.LP
On the author's system, this script takes circa 0.07 seconds to
filter through an mbox index with 2000 messages (or, in other words,
slightly less than the average time it takes for the Python interpreter
just to start).
|