Mutt – A Command Line Email Client to Send Mails from Terminal

As a System admin, sometimes we need to send mails to users or someone else from the server and for that we used to go with a web based interface to send email, is it really that handy ? Absolutely No.

Linux Mutt Command

Mutt Command Line Email Client

Here in this tutorial, we’ll be using the mutt (a terminal email client) command to send email from command line interlace.

What is Mutt?

Mutt is a command line based Email client. It’s a very useful and powerful tool to send and read mails from command line in Unix based systems. Mutt also supports POP and IMAP protocols for receiving mails. It opens with a coloured interface to send Email which makes it user friendly to send emails from command line.

Mutt Features

Some other important features of Mutt is as follows:

  1. Its very Easy to install and configure.
  2. Allows us to send emails with attachments from the command line.
  3. It also has the features to add BCC (Blind carbon copy) and CC (Carbon copy) while sending mails.
  4. It allows message threading.
  5. It provides us the facility of mailing lists.
  6. It also support so many mailbox formats like maildir, mbox, MH and MMDF.
  7. Supports at least 20 languages.
  8. It also support DSN (Delivery Status Notification).

How to Install Mutt in Linux

We can install Mutt Client in our Linux box very easily with any package installers as shown.

# apt-get install mutt (For Debian / Ubuntu based system)
# yum install mutt (For RHEL / CentOS / Fedora based system)
Configuration files

Configuration files of Mutt Email client.

  1. Main Configuration file: To make changes globally for all users For mutt, you can make changes in its mail configuration file “/etc/Muttrc“.
  2. User Configuration file of Mutt : If you want to set some specific configuration for a particular user for Mutt, you can configure those settings in ~/.muttrc or ~/.mutt/muttrc files.
Basic Syntax of mutt command
mutt options recipient
Read Emails with Mutt

To read emails of the user with you are currently logged in, you just need to run “mutt” on the terminal, it will load the current user’s mailbox.

[[email protected] ~]#  mutt
Read Mail from Command Line

Read Mail from Terminal

To read the emails of a specific user, you need to specify which mail file to read. For example, You (as root) wants to read mails of user “John“, you need to specify his mail file with “-f” option with mutt command.

[[email protected] ~]#  mutt -f /var/spool/mail/john

You may also use “-R” option to open a mailbox in read-only mode.

Send an email with mutt command

In this example, following command will send a test Email to [email protected]. The “-s” option is used to specify Subject of the mail.

[[email protected] ~]#  mutt -s "Test Email" [email protected]

When you enter the above command in the terminal, it opens up with an interface and confirms the recipient address and subject of the mail and opens up the interface, here you can make changes to recipient mail address.

  1. Change recipient email address pressing t.
  2. Change Cc address with c.
  3. Attach files as attachments with a.
  4. Quit from the interface with q.
  5. Send that email by pressing y.

Note: When you press “y” it shows the status below that mutt is sending mail.

Send Mail from Command Line

Send Mail from Terminal

Add Carbon copy(Cc) and Blind Carbon copy(Bcc)

We can add Cc and Bcc with mutt command to our email with “-c” and “-b” option.

[[email protected] ~]# mutt -s "Subject of mail" -c <email add for CC> -b <email-add for BCC> mail address of recipient
[[email protected] ~]# mutt -s “Test Email” -c [email protected]  -b [email protected] [email protected]

Here in this example, root is sending email to [email protected] and putting [email protected] as Cc address and [email protected] as Bcc.

Send Mail as Bcc in Terminal

Send Mail as CC or BCC in Terminal

Send Emails with Attachments

We can send email from command line with attachments by using “-a” option with mutt command.

[[email protected] ~]# mutt  -s "Subject of Mail" -a <path of  attachment file> -c <email address of CC>  mail address of recipient
[[email protected] ~]# mutt -s "Site Backup" -a /backups/backup.tar  -c [email protected] [email protected]
Send Email Attachment from Command LIne

Send Email Attachment from Terminal

Here in above snapshot, you can see that it shows attachment attached with the mail.

Use of muttrc file

If we want to change the senders name and email, then we need to Create a file in that particular user’s home directory.

[[email protected] ~]# cat .muttrc

Add the following lines to it. Save and close it.

set from = "[email protected]"
set realname = "Realname of the user"
Getting Help

To print the help menu of “mutt”, we need to specify “-h” option with it.

[[email protected] ~]# mutt -h

Mutt (2006-07-14)
usage: mutt [ -nRyzZ ] [ -e <cmd> ] [ -F <file> ] [ -m <type> ] [ -f <file> ]
       mutt [ -nx ] [ -e <cmd> ] [ -a <file> ] [ -F <file> ] [ -H <file> ] 
       mutt [ -i <file> ] [ -s <subj> ] [ -b <addr> ] [ -c <addr> ] <addr> [ ... ]
       mutt [ -n ] [ -e <cmd> ] [ -F <file> ] -p -v[v]
  -a <file>     attach a file to the message
  -b <address>  specify a blind carbon-copy (BCC) address
  -c <address>  specify a carbon-copy (CC) address
  -e <command>  specify a command to be executed after initialization
  -f <file>     specify which mailbox to read
  -F <file>     specify an alternate muttrc file
  -H <file>     specify a draft file to read header from
  -i <file>     specify a file which Mutt should include in the reply
  -m <type>     specify a default mailbox type
  -n            causes Mutt not to read the system Muttrc
  -p            recall a postponed message
  -R            mailbox in read-only mode
  -s <subj>     specify a subject (must be in quotes if it has spaces)
  -v            show version and compile-time definitions
  -x            simulate the mailx send mode
  -y            select a mailbox specified in your `mailboxes' list
  -z            exit immediately if there are no messages in the mailbox
  -Z            open the first folder with new message, exit immediately if none
  -h            this help message

This is it with mutt command for now, read man pages of mutt for more information on mutt command.

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Tarunika Shrivastava

I am a linux server admin and love to play with Linux and all other distributions of it. I am working as System Engineer with a Web Hosting Company.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

34 Responses

  1. Tsepo says:

    Hi Linux Guru

    How do you add exchange with MUTT/ALPINE, that will be nice

  2. NewtownGuy says:

    How do I send a text message where mutt does not add any additional information ? I can use SMS gateways just fine, the problem is that when I use a Linux command of the form: echo “text” | mutt [email protected], the text that comes through is of the form, text. I need it to only be “text”.

  3. Vipin says:

    how to add more than one recipients in cc?

  4. Tom Adriaansen says:


    When I sent a mail from my Linux box, with

    mutt \
    -e ‘my_hdr Content-Type: text/html’ \
    -s “${NOW} Controle File-Set SnapShots and Replications (${SUBJ})” \
    -a “/rbm/scr/rbm_check_snap_repl_legenda.html” ${TO_ADDR}

    I get the attachment as inline in my outlook 365 mail. The legenda file I mean.

    –liOOAslEiF7prFVr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline
    V7000 File-System
    rbndtcv7k lnx_nfs_appldev_002 512G 15G 3% 498G
    –liOOAslEiF7prFVr Content-Type: text/html; charset=us-ascii Content-Disposition: attachment; filename=”rbm_check_snap_repl_legenda.html”
    Legenda: icTwa

    What do I have to do, to get an real attachment in outlook 365


  5. santhosh says:

    how to send mail mutt to gmail i did not getting any errors and any mail ,how to reslove the this issue

  6. Can mutt be used to send mail to more than one person in bcc and cc?
    If yes , is the delimiter? It was not working for me.

  7. David Juma says:

    i tested this on Ubuntu 12.04 LTS server. It works perfectly. Thanks a lot for the great article,keep it up!

  8. Salman says:

    Great ! i was thinking something like this to test my mail server… thanks

  9. prashant desai says:

    this all things are nice, thanks for all
    i am new for centos 6.4,6.5 server but i allways follow your website for my work. thank you all of you.

  10. niraj says:

    Informative document

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.