An efficient command-line email client

Enhancements

To enhance your use of Mutt, you will probably want to add a few other commands to muttrc. For example,

set signature="PATH"

points to a file that contains a signature that is added automatically to the end of every email you send. To avoid any conflict between Mutt's use of UTF-8 for a character set and the editor in which you write emails, you should also add:

set send_charset="utf-8"

However, by far the most useful step is to set up encryption for sent mail. If you have not already done so, create ~/.mutt/gpg.rc, then copy to it the file /usr/share/doc/mutt/samples/gpg.rc, and add the following line

source ~/.mutt/gpg.rc

to muttrc.

With this setup, you can press p when composing to use basic GnuPG options. The muttrc man page [3] lists additional encryption options.

Sending Email

All emails sent from Mutt are in plain text for security. However, if you want an HTML message, either compose it in a separate email editor or add the tags manually.

Emails can be sent in two ways. First, you can send an email directly from the command line (see Table 1 for command options), with:

mutt OPTIONS"RECIPIENT-OR-ALIAS"

Table 1

Command-Line Email Options

-a FILE

Attach a file

-b ADDRESS

Add a blind carbon copy (BCC)

-c ADDRESS

Add a carbon copy (CC) recipient

-i FILE

Include a file in the body of the email

-s SUBJECT

Add the subject of the message

When you press the Enter key, Mutt asks for confirmation of the options and then opens in the default editor so that you can type the message (Figure 1).

Figure 1: Mutt can use any command-line editor, including Vim, Emacs, Nano, or Joe (shown here).

The -R option lets you open a mailbox and select a message to reply to. If you are unsure of the available mailboxes, typing -y will provide a list of available ones. If necessary, -f MAILBOX sets the current mailbox.

An easier way to use Mutt is to type the basic command of mutt, which opens a text-based interface (Figure 2). The interface is entirely mouse driven, with a list of available actions along the top, and a summary of the current mailbox along the bottom. When Mutt runs from the command line, pressing m to start a message runs you through a series of prompts for the headers and then opens Mutt's default editor.

Figure 2: Mutt can be run from the command line, or, more conveniently, through a keyboard-navigated text interface.

Regardless of whether you are running from the command line or the text interface, when you are finished writing your message in the editor, save the file and quit the editor (the exact commands for doing so depend on the editor). A screen appears in which you can make last minute changes, using the options listed at the top of the page, with the message described as the attachment of a file stored in /tmp/mutt (Figure 3). Press y when you are ready to send the message.

Figure 3: Before you send an email, Mutt gives you one last chance to edit the headers and displays a summary of the email.

Other Configuration

The information provided will get you up and running, but it is only a fraction of what Mutt can do. You can add small touches, such as a sidebar that lists mailboxes or configuring Mutt to use Gmail, or more elaborate ones like encrypting email, displaying messages in threads, using custom headers, or running Mutt for local system messages. For additional useful information, see the Mutt documentation [4] and the ArchWiki notes on Mutt [5]. You may have to do some digging, but, to the best of my knowledge, Mutt can do anything the average desktop mail client can do – and with considerably less overhead or problems.

The Author

Bruce Byfield is a computer journalist and a freelance writer and editor specializing in free and open source software. In addition to his writing projects, he also teaches live and e-learning courses. In his spare time, Bruce writes about Northwest coast art (http://brucebyfield.wordpress.com). He is also co-founder of Prentice Pieces, a blog about writing and fantasy at https://prenticepieces.com/.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News