LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
::In The News
::Industry
::Interviews
::Reviews
::Tips
::Tutorials
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Articles :: Tutorials :: Mutt Primer

20 June 2004

Mutt Primer

by Brian Brazil

Mutt is a console based email client. It has built in support for multiple mail folders, POP and IMAP, PGP, aliases, mailing lists, powerful search capabilities and a pile of other stuff. Essentially it can handle a lot of email. This document assumes you are able to run commands in a shell.

Initial Setup

This is optional but will make Mutt a lot nicer to use.

Copy the following into your shell:

cat << "EOF" >> $HOME/.muttrc
set sort=threads
set pager_index_lines=5		#You might want to increase this
set pager_context=1
set index_format='%4C %Z %{%b %d} %-15.15F (%4l) %s'

#Different colors for different levels of quoting
color quoted    magenta         black
color quoted1   blue            black
color quoted2   red             black
color quoted3   yellow          black
color quoted4   cyan            black
color quoted5   blue            black
color quoted6   magenta         black
color quoted7   red             black
color quoted8   yellow          black
color quoted9   cyan            black
color signature blue            default

EOF
	

Starting Mutt

To start Mutt type

	mutt
	
in the shell. This will bring up something like
Mutt index view with messages

To quit press 'q'.

Moving Around

You are now in the index where all the messages in a folder are listed. Pressing '?'(question mark) will generally display all valid keys for a given screen. In the screenshot above you can see a full page of messages.

Handy Movement keys

  • j - move down one (undeleted) message
  • k - move up one (undeleted) message
  • [ - move up half a screen
  • ] - move down half a screen
  • Tab - move to next new message
  • Number<Enter> (e.g. '21<Enter>') - jump to a given message

The arrow keys as well as page up and page down work but shouldn't be depended on.

Looking at a message

Having selected a message pressing <Enter> or <Space> will open the message.
Mutt pager view
The bottom right corner indicates that only 45% of the message is shown.

Pressing <Space> will page froward while '-' (hyphen, dash or minus) will go back. 'j', 'k' and Tab work as above. 'q' or 'i' will go back to the index view.

You will note that some of the index view is shown - this is caused by the 'set pager_index_lines=5' in your Muttrc.

Sending Mail

Replying to mail

If you have a message selected as above pressing 'r' will reply to the sender. Mutt will verify the recipient and subject. You will then be dropped in an editor. Once you have finished creating your message and exited you will come to the compose screen:

Mutt pager view

Pressing 'y' will send the message. 'a' will allow you to attach files. 'e' edits the message. 'q' cancels sending the message.

If you want to reply to all recipients of a mail use 'g' instead of 'r'. It is considered bad practise to use 'g' on a mailing list - unless a CC is requested.

Sending a New Mail

From the pager or index menu pressing 'm' will allow you to send a new mail.

Alternatively from the command line you could type

	mutt bbrazil@netsoc.tcd.ie
	
to send me a mail.

Forwarding Mail

From the pager or index menu pressing 'f' will allow you to forward a mail. It will drop you in a n editor and allow you to make any changes necessary.

Another way(but a bit more advanced) is to use bounce ('b'). This will send an exact copy of a message to someone else.

Aliases

Tired of having to remember difficult email addresses? Aliases can help. In your Muttrc:

	alias brian bbrazil@netsoc.tcd.ie
	alias brazil bbrazil@netsoc.tcd.ie (Brian Brazil)	#With full name
	
You can also specify multiple addresses:
	alias lads joe@netsoc.tcd.ie, mick@tcd.ie, frank@netsoc.tcd.ie
	

Now any time Mutt asks you for an email address you can use brian, brazil or lads.

Deleting Mail

In the index or pager view:

  • d - delete a message
  • J - move up one message, not skipping deleted messages
  • K - move down one message, not skipping deleted messages
  • u - undelete a message
  • Crtl-d - delete a thread
  • Crtl-u - undelete a thread

Note that you will be asked if you really want to delete the messages when you leave the folder or quit.

Reading External Mail

Normally Mutt read mail that is stored on the server. It can access mail on other servers though. For this you can use IMAPS. If you run

	mutt -f imaps://brazilb@mail.tcd.ie	#Change as appropriate
	
you can read your Trinity Email address. Remember though that all you mail remains on tcd.ie servers.

If you would like to transfer all tcd.ie mail to your Matrix account use fetchmail(1).

Note: Instead of 'imaps' you can use 'imap', 'pops' or 'pop'. I prefer imaps because

  1. It remembers which messages you have already read
  2. It is encrypted (as is 'pops')
You can only use what you provider has available.

Advanced

If you have followed the Procmail Guide and have multiple mailboxes life can be a bit easier for you. Put the following in your Muttrc:

	mailboxes imaps://brazilb@mail.tcd.ie
	set imap_pass="my password"	#Can be used without procmail. Also: See warning below
	

Be very careful about putting your password in files. If you are sure you want to do this make sure your Muttrc is not world-readable or everyone will be able to see your password.

Mailing lists

Mutt has very good features for handling mailing lists. To enable them you must specify all the lists you are on. In you muttrc:

	subscribe ilug@linux.ie		#I'm on this list
	#Can have more than one on a line
	subscribe social@linux.ie southeast@linux.ie
	
	#I know these lists exist but I'm not on them
	list @lists.debian.org tech@netsoc.tcd.ie
	

Now all mailing lists will be marked by an 'L' which can be seen in the first screenshot.

Now if you want to reply to a list press 'L'. This will avoid sending copies to previous senders which is considered bad form. If a CC is requested use 'g' instead.

If you get a lot of mail from mailing lists you might want to look at my Procmail on Matrix guide.

More Information

This primer is an altered version of my Mutt primer for Matrix(Netsoc Server) users. Changes include more information on external(i.e. POP3 and IMAP) mailboxes. You might be interested in the original.

General Mail Stuff


Related:
GPG and Mutt


About the author, Brian Brazil.

USERS COMMENTS


                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell