mblaze
—
introduction to the mblaze message system
The
mblaze
message system is a set of Unix
utilities for processing and interacting with mail messages which are stored
in maildir folders.
Its design is roughly inspired by MH, the RAND Message Handling System, but it
is a complete implementation from scratch.
mblaze
consists of these Unix utilities that
each do one job:
- maddr(1)
- extract mail addresses from messages
- magrep(1)
- search messages matching a pattern
- mbnc(1)
- bounce messages
- mcom(1)
- compose and send messages
- mdeliver(1)
- deliver messages or import mbox file
- mdirs(1)
- list maildir folders, recursively
- mexport(1)
- export messages as mbox file
- mflag(1)
- manipulate maildir flags
- mflow(1)
- reflow format=flowed plain text messages
- mfwd(1)
- forward messages
- mgenmid(1)
- generate a Message-ID
- mhdr(1)
- print message headers
- minc(1)
- incorporate new messages
- mless(1)
- conveniently read messages in
less(1)
- mlist(1)
- list and filter messages
- mmime(1)
- create MIME messages
- mmkdir(1)
- create new maildir folders
- mpick(1)
- advanced message filter
- mrefile(1)
- move or copy messages between maildir folders
- mrep(1)
- reply to messages
- mscan(1)
- generate one-line message summaries
- msed(1)
- manipulate message headers
- mseq(1)
- manipulate message sequences
- mshow(1)
- render messages and extract MIME parts
- msort(1)
- sort messages
- mthread(1)
- arrange messages into discussions
mblaze
is a classic command line MUA and has
no features for receiving or transferring messages; you can operate on
messages in a local maildir spool, or fetch your messages using
fdm(1),
getmail(1),
offlineimap(1),
or similar utilities, and send it using
dma(8),
msmtp(1),
sendmail(8),
as provided by OpenSMTPD, Postfix, or similar.
mblaze
operates directly on maildir folders
and doesn't use its own caches or databases. There is no setup needed for many
uses. All utilities have been written with performance in mind. Enumeration of
all messages in a maildir is avoided unless necessary, and then optimized to
limit syscalls. Parsing message metadata is optimized to limit I/O requests.
Initial operations on a large maildir may feel slow, but as soon as they are
in the file system cache, everything is blazingly fast. The utilities are
written to be memory efficient (i.e. not wasteful), but whole messages are
assumed to fit into RAM easily (one at a time).
mblaze
has been written from scratch and is
now well tested, but it is not 100% RFC-conforming (which is neither worth it,
nor desirable). There may be issues with very old, nonconforming, messages.
mblaze
is written in portable C, using only
POSIX functions (apart from a tiny Linux-only optimization), and has no
external dependencies. It supports MIME and more than 7-bit messages
(everything the host
iconv(3)
can decode). It assumes you work in a UTF-8 environment.
mblaze
works well with other Unix utilities
such as
mairix(1),
mu(1),
or
offlineimap(1).
mblaze
utilities are designed to be composed
together in a pipe. They are suitable for interactive use and for scripting,
and integrate well into a Unix workflow.
For example, you could decide you want to look at all unseen messages in your
INBOX, oldest first.
mlist -s ~/Maildir/INBOX | msort -d |
mscan
To operate on a set of messages in multiple steps, you can save it as a
sequence, e.g. add a call to ‘
mseq -S
’
to the above command:
mlist -s ~/Maildir/INBOX | msort -d |
mseq -S | mscan
Now mscan will show message numbers and you could look at the first five
messages at once, for example:
mshow 1:5
Likewise, you could decide to incorporate (by moving from
new to
cur) all new messages in all folders,
thread it and look at it interactively:
mdirs ~/Maildir | xargs minc |
mthread | mless
Or you could list the attachments of the 20 largest messages in your INBOX:
mlist ~/Maildir/INBOX | msort -S |
tail -20 | mshow -t
Or apply the patches from the current message:
mshow -O. '*.diff' |
patch
As usual with pipes, the sky is the limit.
mblaze
deals with messages (which are files),
folders (which are maildir folders), sequences (which are newline-separated
lists of messages, possibly saved on disk in
${MBLAZE:-$HOME/.mblaze}/seq), and the
current message (kept as a symlink in
${MBLAZE:-$HOME/.mblaze}/cur).
Messages in the saved sequence can be referred to using special syntax as
explained in
mmsg(7).
Many utilities have a default behavior when used interactively from a terminal
(e.g. operate on the current message or the current sequence). For scripting,
you must make these arguments explicit.
For configuration, see
mblaze-profile(5).
mailx(1),
mblaze-profile(5),
nmh(7)
Leah Neukirchen
<
leah@vuxu.org>
There is a mailing list available at
mblaze@googlegroups.com
(to subscribe, send a message to
mblaze+subscribe@googlegroups.com)
and an IRC channel
#vuxu
on irc.freenode.net. Please
report security-related bugs directly to the author.
mblaze
is in the public domain.
To the extent possible under law, the creator of this work has waived all
copyright and related or neighboring rights to this work.
http://creativecommons.org/publicdomain/zero/1.0/