Mutt Scoring

by David A. Harding

Why you’d want to
There’s a lot of email to be read. Message scoring, an ability of the mutt Mail User Agent (MUA), allows you to prioritise what you want to read and filter out what you don’t want to read.

Enable score view
If your using Mutt for the first time, I suggest you read the section of the Mutt Manual titled, Getting Started.

The first step is to display message scores. By default, mutt doesn’t show you message scores. Although you can manipulate, sort, and filter by scores without seeing them, it’s rather user unfriendly. Let’s change the index format—the information displayed in the index view—to something more useful. Add the following line to your ~/.muttrc.

set index_format="%2N %Z %{%b %d} %-15.15F %s"

%2N tells mutt to devote two (2) columns to the message score (N). For an explaination of the other variables, see the reference section of the Mutt Manaul.

Score based on email address
I think the most used scoring method is scoring by email address. I want email from my friends and family to receive higher scores than email from mere acquantances, and email from acquantances to receive higher score than email from strangers.

Below is the a rule that adds 10 points to the score of any email from my friend, Captian Kirk. Add the following line ot your ~/.muttrc.

score "~f kirk@enterprise.starfleet.mil.ufp" 10

Score based on other rules
You score based on most of the critera mutt allows you to search or filter on. Let me give you some of my favourites:

## Add a point to GPG signed messages
score "~g" 1

## Add a point to GPG encrypted messages
score "~G" 1

## Add a point to Flagged messages
score "~F" 1

## Add a point to messages from a known mailing list 
## * Use the, `subscribe' and `lists' command to tell mutt about lists
score ~~l" 1

## Add a point to old (unread) messages
score "~O" 1

## Add a point to messages addressed to you 
score "~p" 1

## Add a point to messages from you
score "~P" 1

## Add a point to messages you replied to (using mutt)
score ~~Q" 1

## Add a point to read messages
score "~R" 1

## Add a point to messages less than 80,000 bytes 
score "~z 0-80000" 1

Sort based on scores
Sorting based on scores is the most useful feature of scoring. I want the top scoring messages to come to the top of each mailbox. In this way, I read the important mail first.

First, we want to make threading the primary sorting method (this is the default). You will regret it if you break threading.

set sort=threads

Now we make scores the auxiluary sorting method. The threads with the hightest scoring messages will come to the top of the index view.

set sort_aux=score

Don’t be negative
mutt scores are always greater than or equal to zero —mutt(1)

You can also subtract points from a message. But a message’s points may only go down to zero. If a message would have a score less than zero, the message’s score becomes zero.

score ~f archer@starfleet.earth.sol -1

David A. Harding began using Linux in 2001 and quickly became a Linux Professional Institute certified system administrator. His articles have appeared in over a dozen publications and he has given over 50 presentations about Linux—including two Software Freedom Day keynotes. Dave always loves to hear from readers at dave@dtrt.org.

CC0
To the extent possible under law, David A. Harding has waived all copyright and related or neighboring rights to this article. This work is published from the United States.

Any original program code in this article is also unlicensed for redundancy.