Mutt is a command line email app for Linux and here's how to set it up - gHacks Tech News

ADVERTISEMENT

Mutt is a command line email app for Linux and here's how to set it up

Mutt is a command line email app for Linux; we continue our series of reviews for Linux-based command line applications. Check out MusicCube (music player) or nnn (file manager).

Like many terminal programs, it too has a learning curve, perhaps more than the average app. We'll try to help simplify the process to set it up and explain how to use it.

Mutt view inbox

Open a terminal to run the app and type mutt. The app's running but can't work because you haven't setup your email account.

This is where you may get confused: How do I set up Mutt?

Create the configuration file

We need to place the configuration file "muttrc" in the location ~/.mutt/muttrc. Use the mkdir command or manually create it in your home/USERNAME folder. Edit the muttrc using any text editor; this document will contain the settings which are required to authenticate the email account.

Tip: I'll tell you how I learned to use the program. Add one line (command) to the muttrc at a time, run the app and see what happens. It took some trial and error, but it was a rewarding experience.

If you're using 2-factor authentication (and you certainly should), you'll need to use an app password (for Gmail, Outlook, etc) to login.

Add the following lines to the muttrc file.

set imap_user = USERNAME@gmail.com
set imap_pass = YOUR PASSWORD

Let's add the URL for the account. Say, we're going to use Gmail over IMAP and SMTP, you should add this line:

set folder = imaps://imap.gmail.com/

Note: When you try to send a mail, mutt will ask you to enter the password, you can set the smtp_pass attribute to use your IMAP password to avoid manually entering it every time.

We'll need a folder to download your mails from your inbox. Without this, Mutt cannot function. So add the following command to the config.

set spoolfile = +INBOX

You may have noticed that mutt takes a long time to start up (fetching message headers). To reduce this, you can set up the cache using the command

set header_cache = ~/.cache/mutt

Try running mutt again and it should start instantly, because the cache has been stored locally. Similarly, you can define more settings for the Sent, Drafts folders, etc.

Mutt is a command line email app for Linux and here's how to set it up

Interface

The menu bar at the top of the window lets you navigate between various tabs.  A list of keyboard shortcuts is displayed just below the menubar. The large pane in the center is the message viewer pane. You will see the mails that're in your inbox along with the date, name of the sender and email subject. Highlight a message (use the arrow keys), and press enter to view the message.You can scroll down the message/inbox using Page Down and Page Up.

Mutt does not have an email composer built-in, so you'll need to use a text editor. You can use advanced ones like Vim, emacs, or stick to the basic editors.

Tip: Add the command set editor=EDITOR to your muttrc. Replace the EDITOR with your favorite app, for e.g. set editor=emacs.

Press m to compose a new mail, and you'll be prompted to select the recipient's email address, and then the subject. The editor will open in the next step. Save the document and close it. Now, on the send screen in mutt, hit y to send the mail.

Mutt send mail

Try sending an email to yourself to test the functionality and make sure that everything is set up correctly.

Mutt view email

Tip: Press ? to access the built-in help section at anytime.

Mutt help

Here are a few important shortcuts

q = Quit
d = Delete
m = Mail (Compose)
r = Reply
y = Send
i = exit (when reading/sending mails)

There are a lot of configuration files made by other users that you can use. Here's mine which should let you receive, read, send emails.

set imap_user = USERNAME@gmail.com
set imap_pass = PASSWORD OR APP PASSWORD
set realname = "YOUR NAME"
set from = "USERNAME@gmail.com"
set folder = imaps://imap.gmail.com
set smtp_url = "smtps://USERNAME@gmail.com@smtp.gmail.com
set smtp_pass = PASSWORD OR APP PASSWORD
set ssl_force_tls = yes
set header_cache = ~/.cache/mutt
set spoolfile = +Inbox
set record = "+Sent"
set postponed = "+Drafts"
set trash = "+Trash"
set editor = "emacs"

The ArchLinux Wiki for Mutt was used as a reference source for this article.

I didn't want to make this a basic tutorial, but seeing as the official Wiki was a bit confusing, I wrote one to help people. Maybe I'll write a follow-up with advanced options, or review the NeoMutt client soon.

Summary
software image
Author Rating
1star1star1star1star1star
5 based on 2 votes
Software Name
Mutt
Operating System
Linux
Software Category
Internet
Price
Free
Landing Page
Advertisement

Previous Post: «
Next Post: »

Comments

  1. Anonymous said on November 23, 2019 at 12:11 pm
    Reply

    For those who are interested, there is a wizard available here https://github.com/LukeSmithxyz/mutt-wizard

  2. walker said on November 25, 2019 at 9:03 am
    Reply

    Yep a true gem!

  3. John Fenderson said on November 25, 2019 at 6:37 pm
    Reply

    I remember Mutt. It’s truly a great email client. It will be what I fall back to should Thunderbird fail me.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

Please note that your comment may not appear immediately after you post it.