LEI-MAIL-FORMATS(5)

NAME
lei-mail-formats - description of mail formats supported by lei

DESCRIPTION
lei-q(1) supports writing to several existing mail formats for interoperability with existing mail user agents (MUA); below is an overview of them to help users choose.

Maildir
The default output format when given a filesystem path, it supports parallel read-write access. Performance is acceptable for smaller directories, but degrades as mailboxes get larger. Speed and scalability are limited by kernel and filesystem performance due to the use of small files and large number of syscalls.

See also: <https://cr.yp.to/proto/maildir.html> and <https://wiki2.dovecot.org/MailboxFormat/Maildir>

Mbox family
The mbox family consists of several incompatible formats. Locking for parallel access is supported, but may not be compatible across tools. With compression (e.g. gzip(1)), they require the least amount of space while offering good read-only performance.

Keyword updates ("Status:" and/or "X-Status:" headers) generally require rewriting the entire mbox.

See also: <https://www.loc.gov/preservation/digital/formats/fdd/fdd000383.shtml>, mbox(5)

  mboxo
The traditional BSD format. It quotes "From " to ">From ", but lines already beginning with ">From " do not get quoted, thus automatic reversibility is not guaranteed. MUAs which favor "mboxcl" or "mboxcl2" may convert these automatically to their preferred format.

Truncation is undetectable unless compressed with gzip or similar.

  mboxrd
An evolution of "mboxo", but quotes "From " lines prefixed with any number of ">" characters and is thus fully reversible.

This format is emitted by PublicInbox::WWW(3pm) with gzip. Since git 2.10, "git am --patch-format=mboxrd" reads this format. "git log" and "git format-patch --stdout" can also generate this format with the "--pretty=mboxrd" switch.

As with uncompressed "mboxo", uncompressed mboxrd are vulnerable to undetectable truncation.

It gracefully degrades to being treated as "mboxo" by MUAs unaware of the format as excessive ">From " quoting is recognizable to humans.

  mboxcl
"mboxo" with a "Content-Length:" header, "From " lines remain quoted to retain readability with "mboxo" and "mboxrd" MUAs. However, it is easy to corrupt these files when using tools which are not aware of "Content-Length:" and write out updates as "mboxo".

mutt(1) will convert "mboxo" and "mboxrd" to mboxcl upon opening.

See also: <https://www.jwz.org/doc/content-length.html>

  mboxcl2
Like "mboxcl", but without "From " any quoting. It is wholly incompatible with MUAs which only handle "mboxo" and/or "mboxrd". This is format is generated by mutt(1) when writing to a new mbox.

MH
Preliminary support for reads as of 2.0.0. Locking semantics differ incompatibly amongst existing writers: Python and nmh appear compatible with each other, while mutt appears racy and unsuitable for parallel access due to rename(2) potentially clobbering the ".mh_sequences" file. More info about other clients is greatly appreciated.

Sequence numbers may be packed and reused by some writers, so lei users may need to run lei-refresh-mail-sync(1) if inotify|kevent missed packing while lei-daemon(8) wasn't running.

lei is safe for reading mlmmj archives as MH since mlmmj neither packs nor uses a .mh_sequences file to store state.

MMDF
Not yet supported, and it's unclear if current usage/support makes it worth supporting.

IMAP
Depending on the IMAP server software and configuration, IMAP servers may use any (or combination) of the aforementioned formats or a non-standard database backend. Currently, lei uses Mail::IMAPClient which has acceptable performance over low-latency links. Performance over high-latency links is currently poor.

eml
A single raw message file. "eml" is not an output format for lei, but accepted by as an "--input-format" ("-F") for read-only commands such as lei-tag(1) and lei-import(1).

Since "eml" is the suffix for the "message/rfc822" MIME type (according to the "mime.types" file), lei will infer the type based on the ".eml" suffix if "--input-format" is unspecified

".patch"-suffixed files generated by git-format-patch(1) (without "--stdout") are "eml" files with the addition of an mbox "From " header. lei(1) removes "From " lines to treat them as "eml" when reading these for compatibility with "git-am(1)" and similar tools.

COPYRIGHT
Copyright 2021 all contributors <mailto:meta@public-inbox.org>

License: AGPL-3.0+ <http://www.gnu.org/licenses/agpl-3.0.txt>

SEE ALSO
lei(1), lei-q(1), lei-convert(1), lei-overview(7)