From ArchWiki
Revision as of 08:14, 28 November 2005 by
Jump to: navigation, search

Mutt is a text-based mail client renowned for its powerful features. Mutt, though over a decade old, remains the mail client of choice for great number of power-users. Unfortunately, a default mutt install is plagued by complex keybindings, and a daunting amount of documentation. This guide will help the average user get mutt up and running, and begin customizing it to his/her taste.

Quick Start

What Mutt Does Not Do

Mutt is a Mail User Agent (MUA), and was written to view mail. It was not written to retrieve, send, or sort mail. It relies on external programs to do those tasks. For this wiki, we will be using getmail to retrieve our mail, procmail to sort our mail, and msmtp to send our mail.

Setting up for POP mail

Because IMAP protocol does not cache your mail locally you can skip this section.

Retrieving Mail

First install getmail. It is in the [extra] repository.

 pacman -S getmail

Now create the directory ~/.getmail/. Open the file ~/.getmail/getmailrc in your favorite text editor.

Here is an example getmailrc used with a gmail account.

type = SimplePOP3SSLRetriever
server =
username =
port = 995
password = password

type = Maildir
path = ~/mail

You can tweak this to your POP3 service's specification.

For this guide we will be storing our mail in the maildir format. The two main mailbox formats are mbox and maildir. The main difference between the two is that mbox is one file, with all of your mails and their headers stored in it, whereas a maildir is a directory tree. Each mail is its own file, which will often speed things up.

A maildir is just a folder with the folders cur, new and tmp in it.

   mkdir -p ~/mail/{cur,new,tmp}

Now, run getmail. If it works fine, you can create a cronjob for getmail to run every n hours/minutes. Type crontab -e to edit cronjobs, and enter the following:

 /30 * * * * /usr/bin/getmail

That will run getmail every 30 minutes.

Sorting Mail

Procmail is an extremely powerful sorting tool. For the purposes of this wiki, we will do some primitive sorting to get started.

First, install procmail. It is in the [current] repository.

 pacman -S procmail

You must edit your getmailrc to pass retrieved mail to procmail.

type = MDA_external
path = /usr/bin/procmail

Now, open up .procmailrc in your favorite editor. The following will sort all mail from the happy-kangaroos mailing list, and all mail from your lovey-dovey friend in their own maildirs.


* ^

* ^

After you've saved your .procmailrc, run getmail and see if procmail succeeds in sorting your mail into the appropriate directories.

Setting up for SMTP

Whether you use POP or IMAP to recieve mail you will probably still send mail using SMTP.

Sending Mail

Msmtp is a very simple and easy to use smtp client. It is in the [extra] repository.

 pacman -S msmtp

Open up ~/.msmtprc in your favorite editor. The following is an example of an .msmtprc for a gmail account:

account default
port 587
protocol smtp
auth on
password mypassword
tls on
tls_starttls on

Now mutt must be configured to use msmtp. Make a directory ~/.mutt/, and open up ~/.mutt/muttrc. The following should get you started viewing and sending mail.

set realname='Disgruntled Kangaroo'

set sendmail="/usr/bin/msmtp"

set edit_headers=yes
set folder=~/mail
set mbox=+mbox
set spoolfile=+inbox
set record=+sent
set postponed=+drafts
set mbox_type=Maildir

mailboxes +inbox +lovey-dovey +happy-kangaroos

Now, startup mutt. You should see all the mail in ~/mail/inbox. Press m to compose mail (it will use the editor defined by your EDITOR environment variable. If this variable is not set, type export EDITOR=/path/to/yourfavorite/editor. For testing purposes, address the letter to yourself. After you have written the lovely letter, use your editor's save and exit command. You will return to mutt, which will show you information about your e-mail. Press y to send it. If everything works, congratulations! You can use mutt! However, realizing the true power of mutt comes with much customizing.

Customizing Mutt

Coming Soon, but until then, you can view some sample mutt configs at the Mutt Wiki.

xterminus is pretty active in the mutt community, so if you have any mutt specific questions, feel free to ask in the irc channel.