Learning Mutt

A solution for those mutterings of discontent with your mailer

  1. Here, pooch! Starting Mutt
  2. Round round get around I get around: Getting Around in the Menu
  3. Reading Messages
  4. Deleting Messages
  5. Speak! Sending Messages
  6. Replying to Messages
  7. Forwarding Messages
  8. Saving Messages
  9. Printing Messages
  10. Never Put Off Till Tomorrow What You Can Put Off Till Next Week: Postponing Messages
  11. Teaching an Old Mutt to Do New Tricks: Customizing Mutt
  12. Mutt Commands Quick Reference

Note: Text in bold is stuff you type at your shell prompt, such as:
ls
Text in italics is stuff that will appear on the screen, such as:
Reading /var/spool/mail/lharden (20%)


Starting Mutt

You can use mutt in two ways, similarly to mail. You can use it to send a quick message from a file, or you can bring up the list of messages in your mailbox and go from there.

On the UCOLick network, Mutt is found in /opt/bin/mutt. If you have trouble starting mutt, check your PATH to see if /opt/bin is included. If it isn't, and you're on a managed host, you can put /opt/bin into your PATH if you're comfortable editing your .profile or .cshrc file. Contact NICS if you have trouble starting mutt and fall into one of the following categories:

Please tell us about any error messages you receive when you try to start mutt. Be sure to tell us which machine you were using when you had the problem.

Table of Contents


Using Mutt from the Command Line

This is quite similar to using mail from the command line. The main difference is that, instead of typing mail, you type mutt:

mutt nics < my.problem

If you haven't used mail this way before, this mails (or should it be mutts?) a copy of the file called my.problem to nics.
The following options are available:

A more complex example:

mutt -s "Party Invitation" faber bolte george -c lharden jrickard -b lin < invitation

This sends the contents of the file "invitation" from your current working directory with the subject header "Party Invitation" to faber, bolte, and george, with carbon copies to lharden and jrickard and a blind carbon copy to lin.

Table of Contents


Getting Into and Out Of the Mutt Menu

To bring up a list of your email messages, type:

mutt

You should get a blank terminal with something like this at the bottom:

Reading /var/mail/lharden (20%)
(although, in your case, it had better not be /var/mail/lharden- I don't like other people reading my mail)

After a while (depending on the size of your inbox) a list of messages will come up:


1 Apr 01 Linda Harden ( 1) April Fool!
2 Apr 10 NICS (50) Ra Going Down Today
3 N Apr 15 Spam Unlimited (1000) Money-Making Scam of the Day
4 N Apr 15 Your Friends at the IRS (600) It's Tax Time Again
5 N Apr 15 NSF Grants (1100) Congratulations, we're giving you giant research bucks!

Messages marked with an N (3 and 4 here) are new messages.
Note to mailx users: the N is on the right side of the message number instead of the left.

See the sections on Getting Around in the Menu, Reading Messages, Deleting Messages, Replying to Messages, Sending Messages, Saving Messages, and Printing Messages for what to do now.

When you're done using this menu, type

q

to quit. Mutt will ask you if you want to save read messages to mbox, or if you want to remove your deleted messages. Saving read messages to mbox will copy them to the file mbox in your home directory, and delete them from the mail spool. Removing deleted messages is just what it sounds like. See Customizing Mutt for how to make mutt do what you want without asking you every time.

Table of Contents
Mutt Commands Quick Reference


Getting Around in the Menu

The current message will be highlighted.

See Getting Into and Out Of the Mutt Menu if you've forgotten how to exit this menu.

Table of Contents
Mutt Commands Quick Reference


Reading Messages

So you're saying, "All right, enough already! How do I read my messages?"

Select the message you wish to read from the menu (see Getting Around in the Menu) and hit the < Enter > key.

When you first enter a message, you will be looking at the top part of the message, similar to what happens if you look at a text file using "more". Mutt's pager is similar to more, only better- it allows you to scroll upward as well as downward.

You can also use the PageUp and PageDown keys to move up and down in a message.

If you try to move down (with either Space or PageDown) when you're at the bottom of a message, the top of the next message will be displayed. This doesn't work the other way- if you try to move up from the top of a message, the message:

Already at top of message

is displayed.

The up and down arrow keys work the same way while reading a message as they do in the menu. The up arrow key takes you to the previous message, and the down arrow takes you to the next message.

To return to the menu from reading a message, type

i

and you will be returned to the menu with the message you were just reading selected as the current message.

Table of Contents
Mutt Commands Quick Reference


Deleting Messages

Deleting messages can be done either while reading a message or from the menu.

Messages selected for deletion will be marked with a D. If you have selected a message to be deleted, Mutt will skip that message when you are moving up or down between messages (see Getting Around in the Menu). If you want to access a deleted message, type the number of the message, hit < Enter > , and it will be highlighted.

If you change your mind and decide not to delete one or more of the messages marked for deletion, select the message and type

u

The message will no longer be marked for deletion, and will be treated in the same way as all other read messages.

A message that has been marked for deletion has not actually been deleted. It is still present in the menu and still exists in your mail spool file. Messages selected for deletion can actually be deleted in two ways.

Table of Contents
Mutt Commands Quick Reference


Sending Messages

You can send a new message from the menu or from a message you are reading. If you send it from a message you are reading, it will not be a reply to that message, or include any text from that message. See Replying to Messages if that's what you want to do.

To send a message, from the menu or from reading a message, type

m

You will be given a

To:

prompt. If you decide that you didn't really want to send a message, hit < Enter > , and Mutt will return to what it was doing before you typed m.

What happens now depends on your setup in your .muttrc file (see Customizing Mutt). You may be given a

Cc:

and/or a

Bcc:

prompt. You will be given a

Subject:

prompt. If you change your mind and decide not to send a message, leave the Subject line blank. Mutt will ask if you want to abort the message.

At this point, you will be in an editor, editing the body of the message. There are two ways you can change your editor.

  1. You can enter the following line in your .profile or .cshrc:
    setenv EDITOR emacs -nw
    (substitute your favorite editor for emacs -nw)
  2. or you can use your .muttrc file to select an editor.
Write your message, then save your work and exit the editor. Use

At this point, you will be asked if you want to save your work as

/tmp/mutt-hostname-other-junk.

Say Yes, unless you've changed your mind and don't want to send the message.

You'll be in a screen that contains the header information for your message, and some commands listed at the top of the screen:

Table of Contents
Mutt Commands Quick Reference


Replying to Messages

To reply to a message, either select the message in the menu, or read the message. Type

r

and you will be able to create a reply to the message.

This is done the same way as sending messages, except that you should select or read the message to which you want to reply. You will be asked if you want to include the original message in your reply after you are prompted for the Subject.

Depending on your setup, your message may be automatically aborted if you attempt to send a reply that contains only the original message (with no text added by you).

Table of Contents
Mutt Commands Quick Reference


Forwarding Messages

This is similar to replying to messages. To forward a message, select it in the menu, or read it and type

f

You will be prompted the same way as for sending messages, and will be put into an editor to edit the message for forwarding.

Table of Contents
Mutt Commands Quick Reference


Saving Messages

Mutt will save messages into a mailbox or a file in your home directory. To save a message, select it in the menu or read it, then type

s

You will be prompted for which mailbox you want to save it in.

=:name means < folder directory > /name. See Customizing Mutt for how to set this.

If you don't want to save it there, delete that name and put in a file name with pathname (~/filename puts it in your home directory). The message will then be marked for deletion. You can undelete it if you want it to stay in your mail spool file as well.

Table of Contents
Mutt Commands Quick Reference


Printing Messages

You can print your mail messages directly to a printer. To print a message, select it in the menu or read it, then type

p

You can use your .muttrc file to tell Mutt things like which printer to send printed messages to.

Table of Contents
Mutt Commands Quick Reference


Postponing Messages

Now the fun stuff: something you can do in mutt, but can't do in mail or mailx.

You're working on a lengthy email, and you get another urgent email that you need to reply to immediately (if not sooner). But you don't want to lose all your work on the email you're working on now.

Or maybe you're working on an email from one of the fourth floor cubicles, and you realize it's colloquium time. You aren't finished with your email, but you really want to go to this colloquium. You don't want to xlock the terminal and prevent everyone else from using it while you're at colloquium, but what else can you do?.

In cases such as these, you can postpone a message to work on it later. To do this, save your work (see Sending Messages). When you reach the screen where you can edit the headers, select q to abort. You will be asked if you want to postpone the message. Say Yes.

The next time you send a message, you will be asked if you want to recall a postponed message. Mutt saves postponed messages between sessions, so you can quit mutt and come back in, and your postponed messages will be waiting for you.

Table of Contents
Mutt Commands Quick Reference


Customizing Mutt

Using This Section

If you've used personal configuration files for mail and pine (.mailrc and .pinerc, respectively), you can probably guess that mutt's configuration file is found in your home directory and is called .muttrc. The way it's set up is not unlike .mailrc and .pinerc.

This section is designed to help you make a .muttrc file. If you're happy with the way mutt is configured by default on the system, you don't need to read this. You can return to the table of contents or cut to the chase by going to the quick reference now. If you do want to create a .muttrc file, you have several choices of how to do it:

  1. The Chinese take-out, order-by-number option:
    You can get a ready-made .muttrc file from /u/lharden/public on isis, megatron, zoltar, mariachi, or bigdog. There are 3 available:
    1. Muttrc1 is a basic sort of pinelike configuration that uses pico as its editor.
    2. Muttrc2 is a basic sort of Berkeley Maillike configuration that uses vi as its editor. It does allow for postponing messages, but it doesn't insist that you work on them when you compose a new message.
    3. Muttrc3 is the .muttrc file with my preferred settings that uses emacs as its editor. It's similar to Muttrc1, because I used pine before I started using mutt.

    Each .muttrc file is available in your choice of five color schemes. Each color scheme except for white text on blue background uses only two colors, and reverses the colors (black text on white background becomes white text on black background) for the status bar and selected message. The white text on blue background option uses yellow text on the blue background for highlighting, to emulate the old WordPerfect color scheme.

    To get one of these files, decide which one you want, and what colors you want. Then run the following command on bigdog, megatron, isis, zoltar, or mariachi:
    cp < Space > /u/lharden/public/Muttrc < number > . < extension > < Space > ~/.muttrc
    There should be no spaces in the command except where explicitly specified by < Space > .
    For example, suppose I want Muttrc number 3 with black text on a white background. I would type:
    cp < Space > /u/lharden/public/Muttrc3.blackwhite < Space > ~/.muttrc
    This would copy Muttrc3.blackwhite into my .muttrc file, so the next time I start Mutt, it will use that .muttrc file.

  2. The cooking-from-scratch option:
    You can write a .muttrc file from scratch in your home directory, using your favorite editor. Or, if there's a ready-made .muttrc file that does almost what you want, you can get it and customize it with an editor.
  3. The dim sum buffet option:
    You can open a .muttrc file in your home directory, then cut and paste the settings you want from this page into it. The lines that are appropriate for cutting and pasting into a .muttrc file are in bold text.
Here's the buffet of settings that I find particularly useful in a basic .muttrc file. They are in alphabetical order here, but the ordering in your .muttrc file doesn't matter.
  1. abort_nosubject
    Values: yes, ask-yes, ask-no, no
    set abort_nosubject=yes
    This tells Mutt to automatically cancel a message if you leave the subject line blank, without asking if you want to cancel the message.
    set abort_nosubject=ask-yes
    set abort_nosubject=ask-no
    The above two are similar. Both tell Mutt to ask if you want to cancel a message if you leave the subject line blank. Ask-yes cancels the message by default (if you don't answer either y or n), and ask-no doesn't cancel the message by default.
    set abort_nosubject=no
    This tells Mutt to let you make messages with blank subject lines, without asking if this means you want to abort the message.
  2. abort_unmodified
    Values: yes, ask-yes, ask-no, no
    set abort_unmodified=yes
    This tells Mutt to automatically cancel a new message or a reply to a message if you haven't modified the original text or added new text, without asking if you want to cancel the message.
    set abort_unmodified=ask-yes
    set abort_unmodified=ask-no
    The above two are similar. Both tell Mutt to ask if you want to cancel a message if you haven't modified the original text or added text. Ask-yes cancels the message by default, and ask-no doesn't cancel the message by default.
    set abort_unmodified=no
    This tells Mutt to let you make replies to messages without modifying the original text and send new messages containing no text, without asking if this means you want to abort the message.
  3. askbcc
    Values: yes, no
    set askbcc
    This tells Mutt to ask you for blind carbon copy recipients when you create a message or reply to a message.
    unset askbcc
    This tells Mutt not to ask you for blind carbon copy recipients when you create a message or reply to a message.
  4. askcc
    Values: yes, no
    set askcc
    This tells Mutt to ask you for carbon copy recipients when you create a message or reply to a message.
    unset askcc
    This tells Mutt not to ask you for carbon copy recipients when you create a message or reply to a message.
  5. beep_new
    Values: yes, no
    set beep_new
    This tells Mutt to beep when you receive a new message while your mailbox is open.
    unset beep_new
    This tells Mutt not to beep when you receive a new message while your mailbox is open.
  6. color
    You can set the colors that mutt uses. Unless you like your system's default colors, or one of the color schemes I created, you'll have to play around with them until you get something you like. Here are excerpts from sample .muttrc files using the color schemes I created:

    1. #Black Text on White Background
      color hdrdefault black white
      color quoted black white
      color signature black white
      color status white black
      color indicator white black
      color normal black white

    2. #White Text on Black Background
      color hdrdefault white black
      color quoted white black
      color signature white black
      color status black white
      color indicator black white
      color normal white black

    3. #White Text on Blue Background
      color hdrdefault white blue
      color quoted white blue
      color signature white blue
      color status yellow blue
      color indicator yellow blue
      color normal white blue

    4. #Green Text on Black Background
      color hdrdefault green black
      color quoted green black
      color signature green black
      color status black green
      color indicator black green
      color normal green black

    5. #Amber Text on Black Background
      color hdrdefault yellow black
      color quoted yellow black
      color signature yellow black
      color status black yellow
      color indicator black yellow
      color normal yellow black

    The most important thing here is that the indicator color scheme must be different from the normal color scheme. The indicator color tells Mutt how to highlight the currently selected message, and if they are the same, you won't be able to tell which message is selected.
    Other colors, such as

  7. copy
    Values: yes, ask-yes, ask-no, no
    set copy=yes
    This tells Mutt to save a copy of any message you send, to the location you specify in the record variable.
    set copy=ask-yes
    set copy=ask-no
    Both of the above tell Mutt to ask if you want to save a copy of a message when you send it. Ask-yes saves a copy by default, and ask-no doesn't save a copy by default.
    set copy=no
    This tells Mutt not to save a copy of any message you send.
  8. delete
    Values: yes, ask-yes, ask-no, no
    set delete=yes
    This tells Mutt to delete messages marked for deletion when you exit.
    set delete=ask-yes
    set delete=ask-no
    The above two are similar. Both tell Mutt to ask if you want to delete the messages you marked for deletion when you exit. Ask-yes deletes the messages by default, ask-no doesn't delete the messages by default.
    set delete=no
    This tells Mutt not to delete the messages you have marked for deletion when you quit.
  9. edit_headers
    Values: yes, no
    set edit_headers
    This lets you edit the message headers while you're editing the message.
    unset edit_headers
    This hides the headers from you while you're editing a message.
  10. editor
    This is where you tell Mutt which editor to use when writing a message. Some popular choices are:
  11. folder
    This is a path to the files containing your saved messages. The default value is ~/Mail:
    set folder="~/Mail"
    If you want to change it to something else, change that path to the path where you want your mailboxes. Make sure it is a directory in which you have write permission; otherwise, you will receive error messages.
  12. include
    Values: yes, ask-yes, ask-no, no
    set include=yes
    This tells Mutt to automatically include a copy of the original message when you reply to a message.
    set include=ask-yes
    set include=ask-no
    These tell Mutt to ask if you want to include a copy of the original message in a reply to a message. Ask-yes includes a copy by default, and ask-no doesn't include a copy by default.
    set include=no
    This tells Mutt not to include a copy of the original message when you reply to a message.
  13. mark_old
    Values: yes, no
    set mark_old
    This tells Mutt to mark messages you have already read so they can be moved to mbox.
    unset mark_old
    This tells Mutt not to mark your old messages for moving to mbox.
  14. mbox
    Meaningless if your .muttrc contains set move=no
    This variable contains the path to the file that contains the messages you have already read. The default is:
    set mbox="~/mbox"
  15. metoo
    Values: yes, no
    set metoo
    When you reply to a message, this sends a copy of the reply to all recipients, yourself included.
    unset metoo
    This excludes your address from the list of addresses when you send a reply to a message.
  16. move
    Values: yes, ask-yes, ask-no, no
    set move=yes
    This tells Mutt to automatically move read messages to the mbox file, either mbox in your home directory or whatever you have set mbox to be. This will delete the messages you have read from the mail server.
    set move=ask-yes
    set move=ask-no
    These tell Mutt to ask if you want to move read messages to mbox. Ask-yes moves the messages by default, and ask-no doesn't move the messages by default.
    set move=no
    This tells Mutt to not even think about moving your read messages off the mail server.
  17. postpone
    Values: yes, ask-yes, ask-no, no
    set postpone=yes
    This tells Mutt to automatically postpone any message you choose not to send when you exit the editor.
    set postpone=ask-yes
    set postpone=ask-no
    The above tell Mutt to ask if you want to postpone a message when you choose not to send it. Ask-yes postpones the message by default, and ask-no doesn't postpone the message by default.
    set postpone=no
    This disables postponed messages. If you choose not to send a message, Mutt automatically aborts the message.
  18. postponed
    Meaningless if your .muttrc contains set postponed=no
    This is the location where your postponed messages are stored. Default is "~/postponed". I like to use:
    set postponed="~/Mail/postponed_mail"
  19. print
    Values: yes, ask-yes, ask-no, no
    set print=yes
    This tells Mutt to automatically print a message if you use the p command.
    set print=ask-yes
    set print=ask-no
    These tell Mutt to ask if you want to print a message when you use the p command. Ask-yes prints the message by default, and ask-no doesn't print the message by default.
    set print=no
    This disables the p command, so you can't print messages directly from your inbox.
  20. print_command
    Meaningless if your .muttrc contains set print=no.
    Tells Mutt what command to use when printing a message using the p command. Default is "lpr". The default I use in my sample Muttrc's is:
    set print_command="lpr -Pfloor4"
    You can, of course, change this to any printer you like.
  21. recall
    Values: yes, ask-yes, ask-no, no
    Meaningless if your .muttrc contains set postpone=no
    set recall=yes
    When you send a new message (not when you reply to a message), this automatically brings up your postponed messages for you to work on.
    set recall=ask-yes
    set recall=ask-no
    These ask if you want to continue working on a postponed message when you send a new message. Ask-yes brings up the postponed messages by default, and ask-no doesn't bring up the postponed messages by default.
    set recall=no
    This tells Mutt to not bring up your postponed messages.
  22. record
    Meaningless if your .muttrc contains set copy=no
    Tells Mutt where to save copies of messages you have sent. I like to use:
    set record="~/Mail/sent_mail"
  23. sort
    Values: date, from, date-received, size
    (There are other ways to sort your mailbox as well- see the reference if you don't see the one you want here) This lets you sort your inbox. Default is:
    set sort=date
    which sorts by the date in the message header. Other values are:
    set sort=from
    This lets you look at all mail from a specific person together in your mailbox.
    set sort=date-received
    The above is good if you receive mail from different time zones. It will sort them based on the time when you received them.
    set sort=size
    This sorts your messages by size. The only circumstance I can think of where you'd use it is if you were trying to reduce the size of your mail spool file.

If you want to know more, here's a reference for all the variables and their default values (our default values may be different).


As users of .mailrc files know, .muttrc is also useful for setting up aliases. Here's an example of setting up an alias:

alias doug Doug Lin < lin@ucolick.org >

By using this alias, if I type "doug" on the To: or Cc: line of a message I'm sending, mutt knows that doug is really lin@ucolick.org. By having a list of email addresses, you can also set up a personal mailing list this way:

alias friends My Best Friends < jrickard@ucolick.org >, < lharden@ucolick.org >, < lanclos@ucolick.org >,
< mhals@ucolick.org >

Table of Contents