Is it possible to save messages in mbox format? I have set mbox_type = Maildir, because I use offlineimap to retrieve my mail. Unfortunately it seems to affect the global settings, and it will save in Maildir format as well, which breaks git patches.

3 Answers 3


Mutt does support reading and writing mbox-format mail folders where all the messages are concatenated into one file. The tradeoff, however of using this format is that when messages are deleted, the entire file needs to be re-written. One advantage, however is that you can gzip-compress the mbox.

AFAIK, you can just refer to any mail folder as you would a regular maildir and mutt will automatically detect if it's a file (use as mbox) or a directory (use as a maildir). Setting mbox_type to maildir really only affects what format NEW mail folders are in when they are created by mutt.


Mutt supports and autodetects 4 mailbox formats: MH, MMDF, mbox, and Maildir.

If you have an existing mbox file messages saved to it will be added to the mbox. mbox_type only sets the default for new mailboxes that you create.


To save a single message to a file even when mbox_type is set to mh or maildir, you can use |cat >FILENAME.

Note that this will not always produce a valid mbox file (where, in particular, all mails must have a Content-Length: header, which maildir can cope without). You cannot later use >>FILENAME to append more messages.

If you do want to make an mbox, you can first create an empty mbox mailbox, which is just an empty file:

!touch foo

Then save to the foo file. The limitation of this approach is that you can't use the mailbox location abbreviations like =foo.

Alternativelty, temporarily :set mbox_type=mbox. If :set mb Tab _ Tab is too much typing, you can make it a macro. Ideally this macro would toggle between mbox and your favorite format, but I don't know how to do that.

  • This will produce a garbled mbox. You have to pipe them through formail -ds to format them properly. Oct 7, 2011 at 4:59
  • @amphetamachine You're right, thanks — I meant my answer as a partial answer for the common case when you want to save a single message in a file, but neglected to say so explicitly. I've updated my answer. Oct 7, 2011 at 7:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .