Translation(s): English - Italiano

(!) ?Discussion


Mutt E-Mail Client

Mutt is a low resource, highly configurable command line e-mail client. Mutt itself is just a program for reading email. Combined with a text editor, POP/IMAP mail fetcher, and MTA, Mutt becomes a full fledged e-mail client.

Mutt is available in the Debian repositories; aptitude install mutt to install it. If you find a bug, please report it: How to report a bug.

Configuring Mutt

Mutt's configuration is controlled from .muttrc in a user's $HOME directory.

The beginning of .muttrc should look something like this:

set mbox_type=maildir
set mbox="~/mail/inbox/"
set spoolfile="~/mail/inbox/"
set folder="~/mail/"
set record="~/mail/sent/"
set postponed="~/mail/postponed/"

This will tell Mutt a lot about how you handle your mail, and where to look for new mail.

If you want Vim like mail reading, you would want to add this in .muttrc:

# Vim like keybinds
bind pager j next-line
bind pager k previous-line

Other random options, taken from my .muttrc:

# Unset Marking Mails Old
unset mark_old

# Cancel a message when subject is blank
set abort_nosubject=yes

# Set default editor
set editor="vi"

# Automatically include message when replying
set include=ask-yes

# Asks to postpone a message when not sent
set postpone=ask-yes

# Ask before printing
set print=ask-yes

# Delete messages without asking when Mutt is quit
set delete=yes

# Add an item for each mailbox
mailboxes ~/mail/debian-user

# Show only important fields in the header
ignore *
unignore from resent-from reply-to x-mailer user-agent date to cc subject

# mail send options
set sendmail="/usr/sbin/ssmtp"

# Order for display of the header fields
hdr_order From: Resent-From: Reply-To: X-Mailer: User-Agent: Date: To: Cc: Subject:

# sort messages by thread
set sort=threads

# Automatically quote message in reply
set include=yes

# Set quotemark to 1 byte
set indent_str="> "

# Only show the body when I edit a message
unset edit_headers

# set up mutt so i can run fetchmail at any time by pressing G
macro index    G "!fetchmail\n"   "Invoke fetchmail"
macro pager    G "!fetchmail\n"   "Invoke fetchmail"

# tell mutt about my mailing lists
subscribe debian-user

# set from to ensure mutt doesn't put user@localhost.localhost 
set from="you@email.com"
set use_from=yes
set envelope_from="yes"

# set realname
set realname="Joe Avg. User"

# # set some coloring for easier mail reading
# Color messages
color index brightyellow default ~N
color index brightred default ~D

# Collapse old messages
set collapse_unread=no
folder-hook . 'push <collapse-all>'

Sending E-Mail with Mutt

To send e-mails with Mutt you'll need to use a MTA. The MTA used in the sample muttrc file is sSMTP, see sSMTP's page for information on setting up sSMTP to work with Mutt and/or Gmail.

Note: This is no longer needed with more recent versions of Mutt, which now has it's own SMTP system. To make use of this, you must put this in your ~/.muttrc:

# Set smtp url
set smtp_url="smtp://user@domain.org[:port]"

If you want SSL encryption put smtps:// instead of smtp:// in the above example.

Using abook with Mutt

Every good MUA has an address book for storing names, numbers, and email addresses, right? Well so does Mutt! You just have to know how to set it up.

First, you'll need abook.

apt-get install abook

Run abook from a terminal and learn the program, it's very simple. Add a new contact (foobar and foo@bar.com if you have no ideas), so we can test Mutt with it.

Next, you'll need to edit your muttrc file to be able to query your address book. Add this into your .muttrc file:

# Use abook with Mutt
set query_command="abook --mutt-query '%s'"
macro index a     "|abook --add-email\n" 'add sender to abook'
macro pager a     "|abook --add-email\n" 'add sender to abook'

Run Mutt, and type a capital Q at the pager. Type in foo (Or the first name of the person you added into your abook), and a list should appear with anybody from your abook matching the query. If you select any of them with the enter key, it automatically starts writing a mail to that person! Now you have Mutt with an address book, sleek eh?

Viewing URLs

Don't you hate having to copy and paste links out of xterm just to view them? Or how about when you're running outside of a X session? This is an easy way to set Mutt up so that you can view URLs without too much hassle, and come back into Mutt when you're done reading the page.

You'll need another package for this one.

apt-get install urlview

And add these lines into your .muttrc file:

# View URLs inside Mutt
macro index \cb   "|urlview\n"
macro pager \cb   "|urlview\n"

Now inside of Mutt, find a mail with a URL in it, and hit Ctrl+B. Click any of the choices that come up, and it will open in a new browser window, which makes viewing URLs ten times easier.