UNIX / Linux : How to install and configure mutt

Mutt is known for being a fast and highly configurable mail client, and since it is text-based, it’s ideal for checking email quickly over SSH.

Installing mutt

mutt can be installed by yum utility as follows.

# yum install mutt
....
Dependencies Resolved

========================================================================================================================================================================================================
 Package                                        Arch                                     Version                                                           Repository                              Size
========================================================================================================================================================================================================
Installing:
 mutt                                           x86_64                                   5:1.5.21-27.el7                                                   base                                   1.4 M
Installing for dependencies:
 mailcap                                        noarch                                   2.1.41-2.el7                                                      base                                    31 k
 tokyocabinet                                   x86_64                                   1.4.48-3.el7                                                      base                                   459 k
 urlview                                        x86_64                                   0.9-15.20121210git6cfcad.el7                                      base                                    27 k

Transaction Summary
========================================================================================================================================================================================================
Install  1 Package (+3 Dependent packages)

Total download size: 1.9 M
Installed size: 7.3 M
Is this ok [y/d/N]: y

Configuring mutt

1. The configuration file for mutt is located at each users home directory as ~/.muttrc. Below is a sample configuration for the .muttrc file. This is all you need to get mutt up and running.

# vi ~/.muttrc
# About Me
set from = "user@domain.com"
set realname = "Firstname Lastname"

# My credentials
set smtp_url = "smtp://user@domain.com@smtp.domain.com:587/"
set smtp_pass = "password"
set imap_user = "user@domain.com"
set imap_pass = "password"

# My mailboxes
set folder = "imaps://imap.domain.com:993"
set spoolfile = "+INBOX"


# Where to put the stuff
set header_cache = "~/.mutt/cache/headers"
set message_cachedir = "~/.mutt/cache/bodies"
set certificate_file = "~/.mutt/certificates"

# Etc
set mail_check = 30
set move = no
set imap_keepalive = 900
set sort = threads
set editor = "vim"

# GnuPG bootstrap
# source ~/.mutt/gpg.rc

2. After configuration done, create cache directory.

# mkdir -p ~/.mutt/cache

Verify

To verify if everything is set up properly, send a test email from the server.

# echo "" | mutt -s "subject" -i body.txt -a attachment.txt recipient@example.com
-s used to specify subject of mail.
-i used to specify file containing message body.
-a used to specify attachment file.

Some other commonly used options with mutt are:

-b used to add Bcc address.
-c used to add Cc address.
-e if you want to specify sender's address (something other than default).
Related Post