Learning Mutt
A solution for those mutterings
of discontent with your mailer
- Here, pooch! Starting Mutt
- Round round get around I get around:
Getting Around in the Menu
- Reading Messages
- Deleting Messages
- Speak! Sending Messages
- Replying to Messages
- Forwarding Messages
- Saving Messages
- Printing Messages
- Never Put Off Till Tomorrow What You Can Put Off Till Next Week:
Postponing Messages
- Teaching an Old Mutt to Do New Tricks: Customizing
Mutt
- 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:
- You don't know how to check your PATH
- You don't want to edit your .profile or .cshrc file
- /opt/bin is in your PATH, but mutt still won't start.
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:
- -s subject
- -c cc_addresses
- -b bcc_addresses
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.
- If you want to go directly to the next new message, use the
< Tab > key.
- To move up and down through the menu, use the up and down arrow keys
located immediately to the right of your Ctrl and Shift keys
(not the arrows on the numeric keypad on the
far right side of the keyboard)
- If this doesn't work, or you're a vi fanatic and don't like using arrow
keys, you can use j for down and k
for up, just like in vi.
- To move a page at a time, use the PageUp and
PageDown keys.
- You can also move through the menu by entering the number of the message
you wish to go to. Say you want to go to message number 500. Type the
following:
500
When you press Enter, you will see a list of messages including message
500 (for me, it starts with 495 and ends with 513- the number of messages
in your list may vary).
- You can also enter:
* (Shift-8)
to go to the last message, or
=
to go to the first message.
- You can also search message subjects for a word, part of a word, or a
phrase. Say you want to find a message with the word "printer" in the
subject. The search works similarly to searching in vi. Type:
/ (a forward slash) to search forward (messages after the current
message), or:
< Esc > / to search backward.
You will be prompted:
Search for:
printer
You will be moved to the first message after the current message whose
subject line contains the word "printer" (upper case or lower case doesn't
matter).
- You can also search the message itself for a word, part of a word, or a
phrase. Type:
< Esc > b
You will be prompted and enter the word the same way as above.
This works the same way as a forward search of subject headers, only it
gives you the next message whose text contains the word you were looking for.
In any of these searches, if you want to move on to the next message
containing the word you searched for:
n
moves you to the next message containing the word. The search will
"wrap" around the end of the mailbox- if you reach the last message,
it will then return to the first message.
- These are the features of the menu that I normally use. There are many,
many more things you can do using this menu. For more information, type:
?
Mutt will bring up a list of keys and what they do. ^ means the Control
key, and < Esc > means the Escape key.
To move through the Help menu, hit the space bar to move down a page,
or type - to move up a page. To exit the Help menu, type:
x
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.
- Use the space bar to move down in a message, just like more.
- Use - to move back up a page.
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.
- You can enter the following line in your .profile or .cshrc:
setenv EDITOR emacs -nw
(substitute your favorite editor for emacs -nw)
- or you can use your .muttrc file to select
an editor.
Write your message, then save your work and exit the
editor. Use
- < Esc > :wq for vi
- ^x^c for emacs
- ^x for pico
- or whatever command your favorite editor uses.
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:
- To send the message as is, type y
- To abort the message and send nothing, type q
If you do this, you will be asked if you want to
postpone the message. If you don't want to send anything or work
on this message again, say No.
- To change the list of recipients in the To: field, type t
- To change the CC list, type c
- To change the Bcc list, type b
- To change the Subject:, type s
- To attach a file, type a
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.
- If you say yes, and have only one postponed message, you will
automatically be put into an editor to work on it.
- If you say yes, and have more than one message, you will be put into
a list of your postponed messages. Select the one you want to work on,
and press < Enter > . You will be put into an editor to work on it.
- If you decide to give up on a postponed message, select it and type
d
It will be deleted when you start working on another postponed message.
- If you say no, you will go through the process for
creating a new message. Your postponed messages will still be there
waiting for you the next time you compose a message. They will not be
deleted.
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:
- 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:
- Muttrc1 is a basic sort of pinelike configuration that uses pico as
its editor.
- 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.
- 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.
- Black text on white background (the background may come up gray
on your terminal)
These have the extension .blackwhite in /u/lharden/public
- White text on black background
These have the extension .whiteblack in /u/lharden/public
- White text on blue background (emulating old WordPerfect 5.1
screens)
These have the extension .whiteblue in /u/lharden/public
- Green text on black background (emulating old green-on-black computer
terminals)
These have the extension .greenblack in /u/lharden/public
- Amber text on black background.
These have the extension .amberblack in /u/lharden/public
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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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:
#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
#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
#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
#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
#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
- red
- cyan
- magenta
- and probably some others are available. I don't find them so useful
for a mailer, but your mileage may vary.
- 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.
- 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.
- 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.
- editor
This is where you tell Mutt which editor to use when writing a message.
Some popular choices are:
- vi:
set editor="vi"
- emacs:
set editor="emacs -nw"
Note: the -nw option tells emacs not to open a new window for editing.
If you don't use -nw, you may have trouble writing messages when you're
logging in remotely.
- pico:
set editor="pico"
Pico is a simplified emacs-like editor. I think it's a good choice for
people new to UNIX editors, because it lists the key bindings at the bottom
of the screen.
- 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.
- 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.
- 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.
- 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"
- 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.
- 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.
- 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.
- 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"
- 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.
- 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.
- 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.
- 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"
- 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