Mutt console email client on Dreamhost

Notice: The article has no links, since DH prevents putting more than 2 links to new users.


1 What is mutt?
2 Configuring Mutt
    2.1 IMAP
        2.1.1 Mixing local folders and IMAP folders
    2.2 POP3
    2.3 TLS
    2.4 Linked shell accounts
3 Compile your own
4 External Links

What is mutt?

Mutt is a text-based e-mail client for Unix-like systems. It was originally written by Michael Elkins in 1995 and released under the GNU General Public License. Mutt supports most mail formats (notably both mbox and Maildir) and protocols (POP3, IMAP, NNTP etc). It also includes MIME support, notably full PGP/GPG integration. It is highly configurable: it has hundreds of configuration directives and commands. It allows for changing all the key bindings and making keyboard macros for complex actions, as well as the colors and the layout of most of the interface. Mutt is also fully controlable with the keyboard, and has support for mail threading, meaning one can easily move around long discussions such as in mailing lists. New messages are composed with an external text editor by default (unlike pine, which embeds its own editor known as pico).
Configuring Mutt

Mutt can work via IMAP or POP3, and this is the only way newer mail-only users can access their mail (if you’ve signed up since DreamHost has moved to “no shell mail”, or if you’ve had a Server Move since then). IMAP is what Webmail uses, and it’s totally awesome, so unless you have reasons otherwise, use that.

Older users with linked shell+mail accounts can access their mail directly, though if you want to be ready for the Brave New World of mail-server-only-email (and so mutt won’t break when there’s a Server Move), you can use IMAP or POP3 instead.

See Mutt and IMAP for the totally awesome and professional page, with sub-sub-sub-sections!

Basic config in your ~/.muttrc file are:

set imap_pass=password
set smtp_url = “smtp://”
set smtp_pass=password
set spoolfile=imaps://
set folder=imaps://
set record="=Sent"
set postponed ="=Drafts"
set mail_check=60 # So mutt doesn’t keep checking your IMAP folders like a chihuahua with ADHD
set imap_keepalive = 10 # You may find a small number (like 10) is required to avoid TLS socket packet length errors.

The spoolfile sets your INBOX, while “folder” sets where your other folders are; “folder” includes “INBOX” because the IMAP server that DreamHost uses puts all folders as subfolders of the INBOX (as you can see in Webmail). This means any new folders are created as INBOX.newfolder, INBOX.anotherfolder, and INBOX.newfolder.subnewfolder (there is some ambiguity about using / or . as a subfolder separator. Mutt can deal, and so can you).

You can now move, save, and copy messages by specifying folder names in the usual way: =Drafts, =Sent, etc.
Mixing local folders and IMAP folders

If you mix local folders (like ~/Mail/mom) and IMAP folders (like imaps://, your life will be more interesting!

Firstly, if your spoolfile is local (not IMAP), then mutt won’t check IMAP folders by default (so you can start up faster). To make it check IMAP anyway, tell your doggie to exercise and turn imap_passive off:

set imap_passive=no

Also, if you’re using a mix of local and IMAP, you’ll likely wish to avoid typing imaps:// repeatedly. To do this, either

set folder to imaps://... (as above) and get used to typing ~/Mail/ frequently, or,
if you have only a few IMAP folders (or a few local folders), you can include them in the mailboxes parameter – you can then access them by typing c<tab><tab> (that’s ‘c’ followed by hitting TAB twice), instead of typing a lot. For example,

mailboxes ! imaps://

(where ‘!’ stands for “spoolfile”) is sufficient if you’re just using server filtering for spam.

Put information here. (See! I told you no-one likes POP3. If you love POP3 and mutt, put ’em here.)

It is highly recommended that you use TLS; using imaps: says “use TLS if you can”, and

set imap_force_ssl=yes
set ssl_force_tls=yes

forces mutt to use TLS (née SSL).

DreamHost currently (2009–Sept) uses TLSv1, which r0x (is secure, as far as we know). If you’re really careful, you can tell mutt to not use SSLv1 and SSLv2, which are insecure (hence why there was a v2 and then a v3), by using:

set ssl_use_sslv1=no
set ssl_use_sslv2=no

However, mutt may not like these, and DreamHost doesn’t use them anyway, so it’s totally paranoid tinfoil hat overkill.

By default, certificates are stored in ~/.mutt_certificates in case you wanna peep them.
Linked shell accounts

NOTE: only valid on non-homie accounts

This isn’t terribly supported, since all the cool kids have moved to IMAP, and even the non-cool kids are getting there, but if you’re 378 years old and like to kick it old skool, read on.

DreamHost recommends older shell+mail accounts use Mutt to access their mail directly via local Maildir files, as Mutt natively supports Maildir.

At the mutt end, the following lines are enough in your .muttrc:

set spoolfile=/home/yourusername/Mail/spool
set mbox_type=Maildir # Use Qmail style mailboxes

Now, getting the mail delivered there – well, presumably you already know where your email is being delivered. You may even have procmail. But that’s really a whole ’nother kettle of fish. And kettles of fish, together with further details on this scenario, are outside the scope of this document.
Compile your own

You may wish to compile your own version of Mutt in your home directory if you’d like a newer version, or if you’d like to apply some of the many patches available (DreamHost uses the Debian version, which has a lot of common patches applied by default… the security fixes have also been backported, so the current version DreamHost is running should be safe against all known exploits).
External Links

Official Mutt website
Official Mutt Wiki
Original DreamHost Knowledgebase article
comp.mail.mutt Usenet newsgroup
Mutt Primer
1 Like