This is the second part in the series on Reading Mail in the Terminal.
Let’s first revisit the directory structure. All the mail is in
~/Mail/local– the local archive, mails that do not need to be on any IMAP server anymore but are too precious to delete
~/Mail/example.org– the synchronised copy of the private email
~/Mail/bigcompany.com– the synchronised copy of the work email
In order to see the synchronised mail, you have to tell (neo)mutt where to find the mail and that it’s a Maildir folder:
# ~/.config/neomutt/neomuttrc set mbox_type = maildir set folder = "~/Mail" set spoolfile = + set mbox = + mailboxes + \ +example.org/Inbox \ +bigcompany.com/Inbox \ +local/Sent \ +local/Drafts \ +local/Archive \ +local/Trash
mbox_type probably needs no further explanation.
folder sets the Maildir folder to the location where the mail is already conveniently located.
spoolfile are just set up to also point at the
+ is a shortcut for the value of
folder; similar to
~ in bash.
If you just try it with this configuration you will get an error from (neo)mutt that
~/Mail/local/Inbox, but that would make it much harder to access the
example.org mailbox and the
Instead we pretend that
cur folders: we symlink them to the preferred main mailbox:
Now (neo)mutt actually finds a proper Maildir folder in
local/Inbox upon start.
By default the shortcut to change folders is C which does not really meet my taste, so instead this unbinds C and sets up F2 to change folders:
But as you may have found out, (neo)mutt will still ask you to enter the folder name that you want to change into. Only when you press ? it will list the folders that we configured in
This can be fixed by replacing the
bind with a macro, like this:
Now upon F2 (neo)mutt will immediately show the configured mailboxes.
One last step regarding changing mailbox is the listing of the mailboxes themselves. I find it a bit too verbose, so I changed the folder_format to this:
%?something? if-case & else-case ? can be used to check the numeric variable
something for it being something else than 0. In this context it means that a
* is shown in front of a mailbox if it contains new mail.
Checking the mailbox state is expensive which is why it’s disabled by default. Setting mail_check_stats to
yes enables it.