Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to open a mbox file? Mutt displays no mails when calling mutt -f sent.mbox.

The mbox format is "From" without colon.

Is there any mbox viewer for Linux?

Thank you in advance.

share|improve this question
Mutt should be able to open an mbox file. It's normal to have a From line without a colon at the top: this is for the email's envelope. It's difficult to diagnose your problem without seeing the file contents. Of course I appreciate the file contents is probably too private to publish. Look at the file as a text file (for example with less). Is the From line followed by header lines (From:, Subject: and so on)? Is there a Lines: header, a Content-Length: header? – Gilles Mar 18 '12 at 19:29
It looks like this: I deleted the recipient, content and domain name. – chris Mar 18 '12 at 20:46
up vote 3 down vote accepted

The first line of the mail is the “envelope From line”. It begins with the 5 characters From␣ where is a space character. This is normal.

From Christian xxx <cg@xxx> Mon May  15 20:22:35 2010

What is unusual is that the email address is between <…>. This is unusual. I don't know if it's against the RFCs or not, but I can see Mutt chokes on it.

You should get a valid mailbox (as in, one that Mutt can parse) by processing the mailbox file through the formail command from procmail Install procmail.

formail -ds sed '1 s/^From .* <\(.*\)>/From \1/' <sent.mbox >sent-reformatted.mbox
mutt -f sent-reformatted.mbox
share|improve this answer
I appreciate your answer. Unfortunately, formail doesn't add this header. RFC 822 / 4155 knows nothing about it. – chris Mar 18 '12 at 22:04
After reformatting the file with formail, four (of a hundred) mails are displayed in mutt. – chris Mar 18 '12 at 22:11
@chris How many files does formail -ds sh -c 'cat >$FILENO.mail' create? Can mutt read them as individual mailboxes containing a single mail? – Gilles Mar 18 '12 at 22:20
@chris Ok, I've reproduced this and found the problem: Mutt doesn't like it when the envelope From line isn't of the form From something@somewhere trailer text. In particular, it ignores a line where the envelope from address is John Doe <add@ress>. Now I'm going to see how to fix this. – Gilles Mar 19 '12 at 20:57
@chris I don't know whether it's a bug in mutt or in the program that produced this mailbox, but see my answer for a fix. – Gilles Mar 19 '12 at 22:12

Any text editor is capable of opening .mbox. Besides text editors Mozilla Thunderbird can open them too.

share|improve this answer
Do I have to copy the file to the Thunderbird profile? I don't want to change it. – chris Mar 18 '12 at 20:50

After a bit of nightmare on Windows with Firefox, where the .mbox gets open but only the first message is available, I found that Evolution works well: I created a new folder and then from File\Import... (I'm from Italy, the menu it's actually Importa...) I was able to read that old messages...

share|improve this answer
I dislike that by opening the mbox file, its really importing the file. – ThorSummoner Sep 1 '15 at 19:06

protected by Community Oct 13 '15 at 14:29

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.