DEV Community

Cover image for Setting up and using the mutt email client in Linux
Maria Campbell
Maria Campbell

Posted on • Updated on

Setting up and using the mutt email client in Linux

This post was originally published on my personal blog mariadcampbell.com.

Table of Contents

What is mutt?

mutt is a powerful Command Line email client that sends and receives
emails via Terminal. I use it in addition to mailx, because unlike
mailx, it is able to send real email attachments as well as save
those attachments on a user's local machine.

mutt supports MIME, GPG, PGP, and threading, making it a
powerful tool for managing emails directly from the Linux Command Line.
mutt also allows system administrators to automate and streamline their
workflows with automated notifications. Email plays a critical role in
system security and can be used to deliver security alerts, confirm user
actions, and even recover lost passwords. By properly managing emails
using mutt, we can enhance the security of our Linux system.

There are many other uses for mutt. To learn more, please visit the
article entitled Mastering Mutt: How to Install Mutt Command in Linux.

Installing mutt

One thing to note: in whichever directory we initialize mutt is the
default directory where email attachments are saved.

mutt is not native to Linux. We have to install it. I am on the
Ubuntu derivative Linux Mint, so I can install it with the
following command(s):



sudo apt update
sudo apt upgrade
sudo apt install mutt


Enter fullscreen mode Exit fullscreen mode

Since I only want to use it locally because I have Linux Mint
installed with VirtualBox and only have so much virtual (and hard)
disk space to work with, I decided to pass up on using an external
(gmail) email address to send and receive emails. My main reason for
wanting to use mutt was because of its ability to send
email attachments and save received attachments locally. There are many
other powerful features available, but this is the feature that grabbed
my attention.

Sending an email locally to another user which contains an attachment

I want to send a file to another user on the local network in Linux
using mutt. I would take the following steps:

  1. First, I would cd into the directory where I first initialized mutt. In my case, it was my home directory, /home/maria.
  2. Next, I would determine which email attachment I want to send to the other user.

Next, I will send a text file called email_attachment.txt to local user
magdala, which contains the text
This is some dummy text for the mutt email attachment demo I am creating for my post entitled "Setting up and using the mutt email client in Linux."
I run the following command in Terminal:



mutt -s "Sending Magdala the email_attachment.txt" -a email_attachment.txt -- magdala@maria-VirtualBox


Enter fullscreen mode Exit fullscreen mode

This opens up the mutt interface in the nano text editor. it looks
something like the following:

Screenshot of the

Then I hit the Return key, and something like the following appears:

Screenshot of the email subject line

Next, I hit Return and the following appears:

Screenshot of the body of the email

The next part is very important to follow correctly. After I have
completed the body of my email, I hit Control + O (not zero) key and
then the Return key, and then the following appears:

Screenshot of sending an email to user magdala

As shown at the top of the window, I hit the y key to actually send
the email to user magdala. Then, at the bottom of the window, "Mail
sent" appears, and then I am taken back to the Terminal command prompt.

Other user receives email and saves email attachment locally

Next, user magdala opens her emails using the mutt command, and
something like the following appears:

Screenshot of user magdala's email inbox

Next, user magdala makes sure to select the email which contains the
attachment she wants to save to her local machine using the Up or
Down arrow key, and then she hits the V key. This results in
something like the following:

Screenshot of attachment saved

Next, user magdala hits the S key, and that is when the text
"Save to file: email_attachment.txt" appears. And then the following
appears after that:

Screenshot of user magdala saving attachment

Next, user magdala hits the Q key, and is taken back to the Terminal
command prompt:

Screenshot of user magdala being taken back to Terminal command prompt

And as also shown in the screenshot, she then runs the ls command to
make sure that the email_attachment.txt file has been saved to her home
directory. And it was!

We have now covered the basics of sending, receiving, and saving
email attachments using mutt.

Asymmetric encryption and decryption series

Top comments (0)