I've written before regarding the command-line email client Mutt, and how useful it can be. Unfortunately, Mutt is designed to read a local mail spool by default. If you need to use Mutt to read email from a remote mail server, IMAP may be the best solution.

There are only a few commands that need to be added to your .muttrc configuration file to enable IMAP access. I'll list the configuration next and list what each option does after that.

set certificate_file  = ~/.mutt_certs
set spoolfile         = imaps://slap@mail.slaptijack.com/INBOX
set folder            = imaps://slap@mail.slaptijack.com/INBOX
my_hdr From: Slaptijack <slap@slaptijack.com>

And now, a bit more detail on what those options are doing.

  • certificate_file - This option isn't technically required, but it tells Mutt where to save the certificates you trust. If you don't have this option specified, Mutt will ask if you accept the certificate of your SSL-enabled IMAP server every time you connect.
  • spoolfile - Location of mail spool. The format used for a non-local spool file is URI-based: imap[s]://[user]@[server]/[mailbox].
  • folder = Location of mail folders. If you plan to store all mail on the server, you'll want to specify this variable so that you can find the folders on your mail server. The format is the same as spoolfile.
  • my_hdr From: - Again, this option is not required to enable IMAP, but is necessary unless your email address is the same as your username and hostname.

Two other options you might find useful are

set record    = =Sent
set postponed = =Drafts

These commands tell Mutt to save sent mail in a folder called "Sent" and unfinished (postponed) email in a folder called "Drafts". The "=" tells Mutt that this folder is a sub-folder of the location listed in the "folders" variable. Therefore, these two folders are on the IMAP server.

Related Reading: