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.

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:
- Its very Easy to install and configure.
- Allows us to send emails with attachments from the command line.
- It also has the features to add BCC (Blind carbon copy) and CC (Carbon copy) while sending mails.
- It allows message threading.
- It provides us the facility of mailing lists.
- It also support so many mailbox formats like maildir, mbox, MH and MMDF.
- Supports at least 20 languages.
- 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.
- Main Configuration file: To make changes globally for all users For mutt, you can make changes in its mail configuration file “/etc/Muttrc“.
- 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

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.
- Change recipient email address pressing t.
- Change Cc address with c.
- Attach files as attachments with a.
- Quit from the interface with q.
- Send that email by pressing y.
Note: When you press “y” it shows the status below that mutt is sending mail.

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 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]

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 1.4.2.2i (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] options: -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.
with gmail default settings under accounts (apps with account access/allow less secure apps – OFF), how can i send mail to gmail.
@Jai,
You don’t need to On/Off default settings of Gmail, just have correct DNS MX record in place for your domain to send mails out using mutt command.
1) Hi team i read in the notes above that in command line or code where i am calling mutt for sending mail, if i need to change my sender id i need to update the .muttrc file at ~/.muttrc, can you confirm if my understanding is correct and it is the only option available ? If that is the only option can you share the tag name which needs to be used to update the sender id.
2) Do we have any option which we can use to have a different replyto option ? i read option ‘
t
‘ is available to change the recipient address, can you help to confirm on this.@Mikhil,
Yes ~/.muttrc only file, where you can specify user related configuration and about replyto option, I never used it, but you should give a try and see..
Hi,
I am new to Linux, trying to learn how to Linux command line. I just got to play with “mutt” mail utility but somehow when I wanted to delete an email (after “mutt” mail displayed a list of mails) I could not delete it (Google says: “tag” before removing) I can not “tag” the one that I wanted to remove. Can anyone help ?
Thank you very much
Hi,
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.
But i don’t want this interface to come up. Actually i am try to write a script to send email for every 2 hours automatically but mutt is not usable for my requirement as manual inputs are required for each time.
Please help to share the option .
Thanks,
Venu.M
First of all, this site has been very helpful to me. Thank you.
Issue:
I have a script file that reads:
At the receiving end, the email address ([email protected]) works great whether you click on it in the header or if you use REPLY.
Where it fails is if you send it to an invalid address. It does not let you know it failed.
Is there another something I should set? A SENDER setting?
If I send it to [email protected] I get no notification that the email could not be delivered. I do if I send it from my personal address, so I know that there isn’t really a [email protected].
My client needs to know if their invoices and statements are not being received.
Any help would be greatly appreciated.
I should probably mention that [email protected] is an alias that sends an email to two different employees. It seems to work fine if you send it from a single name. Is an alias email just not going too work?
Is it possible to send mail with attachment in command line?
Now when I, for example, put in “mutt -s “Test Email” [email protected]“ after that see mutt interface where I have to confirm many things. I don’t want it.
I need an application which send me an email with an attachment from a command line without any confirmation. Only one command, enter and nothing more
@Marcin,
Here are few ways to send email attachment from Linux commandline as explained here: 4 Ways to Send Email Attachment from Linux CLI
mutt [email protected] -s “Email with attachment” -a attachment_file_name < /dev/null
This will send the email and return to the command line. No questions asked.
how can i unable mutt in my unix
Hi ,
What is PGP:clear ?,it is showing none to me.
I want to send the report of more than 400k records in CSV as an attachment but ‘mutt’ is not working, could you please help me in this.
@Prince,
May I know what error you getting while sending attachment through mutt? try this command:
hi admin i have an issue, the cat .mttrc not works
it is
.muttrc
dear…