An IMAP Configuration for Mutt

Usually, I download all my email via fetchmail, sort it into folders using procmail and read the mails with mutt. This works reasonably well and I’ve been using this mail setup without major changes for about 10 years. Since I recently bought a netbook, I also wanted to read mails with it, but without touching my existing mail setup. The netbook should only read mails directly on the server without downloading anything to local disk.

My mail service provider 1&1 supports IMAP and a webmail client that I sometimes use, so I decided to follow the webmail client’s conventions regarding folder names. This way, I can use mutt on the netbook and the webmail client interchangeably.

Based on a mutt configuration for gmail, I ended up with the following IMAP-related settings:

set from = "your.address@example.invalid"
set realname = "Your Real Name"

set imap_user = "my.username@domain.invalid"
set imap_pass = "*******"

set smtp_url = "smtp://$"
set smtp_pass = $imap_pass

set folder = "{}"
set spoolfile = "+INBOX"
set record = "+Gesendete Objekte"
set postponed = "+Entwürfe"
set trash = "+Papierkorb"

set move = no

mailboxes "+INBOX"

set header_cache = "~/.cache/mutt/headers"

The most important account settings are imap_user, imap_pass (optional, mutt will prompt for it), and folder. Folder names prefixed with a + sign are relative to folder. Note that I disabled moving read mails to the mbox folder; I want to keep everything in my inbox. Because of the record setting, all sent mails are recorded in a folder on the IMAP server.

To speed things up, I enabled the header cache. You could also cache entire messages, but since mutt doesn’t expire them yet, I don’t use this feature.

What doesn’t work: Neither fetchmail nor the 1&1 server propagate the IMAP "seen" flag of the emails to a BSD mbox-style "Status: RO" header. Because of this, I have to mark all downloaded mails as read manually.

This entry was posted in linux and tagged , , . Bookmark the permalink.

2 Responses to An IMAP Configuration for Mutt

  1. Settel says:

    For reading IMAP mailboxes from different workstations, I recommend OfflineIMAP. In contrast to fetchmail, it synchronizes the mailbox between server and client (not just downloading them), ie. mails are left on the server as long as you don’t modify or delete them locally. It even uploads mails generated locally to the server, so one can synchronize sent-folder across workstations.

    I’m using it for several years now on my three accounts (home, laptop, work), all of them running mutt as my MUA of choice.


  2. mafr says:

    Hi Settel, nice to hear from you!

    I’ve played with offlineimap (found it after I wrote this posting) and meant to eventually switch to it. However, I had encoding troubles with folder names as the 1&1 server uses some magic names containing umlauts. According to the RFC, the IMAP protocol uses some modified UTF-7 encoding that Python’s standard IMAP module doesn’t support.

    Currently I’m not annoyed enough to fix it :)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s