How do I create a new folder in Mutt
I want to create a new folder from within Mutt. I use Maildir format to store the folders on the machine I am running Mutt on.
(I also view the mail remotely using courier IMAP but this doesnt involve Mutt)
Edited to clarify role of IMAP
Solution 1:
If Mutt cannot create maildirs directly, it is easy to do it yourself. A "Maildir" format mail directory has nothing special except for three subdirectories cur/
, new/
and tmp/
inside.
Assuming that your mail is kept under ~/mail/
, a folder named "Something" would be created like:
-
For the Maildir++ layout used by Courier and Dovecot:
mkdir -p ~/mail/.Something/{cur,new,tmp}
(Note the leading dot – yes, this basically means subfolders are stored as hidden directories...)
Equivalent to:
mkdir ~/mail (implied by `-p`) mkdir ~/mail/.Something (implied by `-p`) mkdir ~/mail/.Something/cur (from brace expansion) mkdir ~/mail/.Something/new (from brace expansion) mkdir ~/mail/.Something/tmp (from brace expansion)
-
For the "filesystem" layout used by some other IMAP daemons:
mkdir -p ~/mail/Something/{cur,new,tmp}
If you want a folder hierarchy "Archive" / "2010" / "06":
-
In Courier's layout, the folder would be named
Archive.2010.06
:mkdir -p ~/mail/.Archive.2010.06/{cur,new,tmp}
-
In the "filesystem" layout, it would be
Archive/2010/06
:mkdir -p ~/mail/Archive/2010/06/{cur,new,tmp}
(Terminology: mail clients keep messages in 'folders', and the filesystem stores everything in 'directories'.)
Solution 2:
c (change-folder
), ? (list), Shift+C (create-mailbox
).
This works with Gmail but only in the single directory view, and not in the "all folders" view.
Also, if you want a space in the directory name, you need to escape it via Ctrl+V, Space.
Solution 3:
I usually just save some email to new not-yet-existing folder, and mutt creates the folder for me.
For me it's pretty intuitive, as there is no point in having folder without mails in it, so I just create it by saving there first mails that should go there.
Solution 4:
If you save a mail into a non-existing location, mutt creates a new mailbox for you. The type of the mailbox is determined by the state of the variable mbox_type
. Hence, to create a Maildir within mutt, you proceed as follows.
Open your .muttrc
file and add the line
set mbox_type=Maildir
This line ensures that mutt creates new mailboxes in the Maildir instead of in the Mbox format.
Then, start mutt and select a message that you want to save into a new folder. Press s
to save and enter the path of the new mailbox (without a slash at the end) and press enter. Mutt will create a new Maildir and saves the message into the newly created mailbox.