Berkeley MBOX is basically a plain-text format so you can view it simply with less
, though you will need to understand SMTP and MIME to make sense of what you are looking at. Every line which matches the regular expression ^From
(with a space after the four alphabetics) is the beginning of a new message. Modern email messages use various MIME transport encodings which can be anything between almost human-readable (=?utf-8?Q?Like_this?=
) to completely oblique (base64).
You can use csplit
on the same regex to split the file into individual messages, or use the formail
utility which is part of the Procmail package with the -s
option. The latter offers a number of options to enable various heuristics if the input file is not completely well-formed, etc.
For graphics-heavy email messages with potentially problematic contents (i.e. spam), I have occasionally spun up Thunderbird in a Virtualbox instance and made sure it has no access to the Internet, then imported the mailbox there for modern HTML etc rendering. If a message requires images from an external server, you just get a placeholder if the image cannot be fetched.