Skip to content

mutt command in Linux

Mutt is a versatile and highly configurable command-line email client for Linux. It supports various protocols and can easily handle multiple mailboxes. Users can efficiently read, send, and manage emails using Mutt’s advanced features and keyboard shortcuts. With support for threading, encryption, and a rich set of customization options, Mutt is a popular choice for many Linux users who prefer a text-based email interface.

mutt Syntax:

Terminal window
mutt [options] [mail-file]

Linux mutt Options:

OptionDescription
-a fileAttach a file to the email
-s subjectSpecify the subject of the email
-c addressSend a copy of the email to the address
-b addressSend a blind carbon copy to the address
-e editorSpecify the text editor to use
-i fileSpecify a different initial email
-F fileSpecify a different configuration file
-HDisplay full headers in the pager
-qQuit after sending the email
-vVerbose mode: display more information

mutt Parameters:

ParameterDescription
mail-fileThe file containing the email to be sent

How to use mutt command:

Sending an Email with mutt

Terminal window
echo "This is the body of the email" | mutt -s "Subject Here" [email protected]

Sends an email with the specified subject and body content to the recipient email address.

Attaching a File to an Email with mutt

Terminal window
echo "See the attached file" | mutt -s "Attachment Test" -a /path/to/attachment.txt [email protected]

Sends an email with an attached file to the recipient email address.

Sending an Email from a File with mutt

Terminal window
mutt -s "Subject Here" [email protected] < email_body.txt

Sends an email with the subject specified and the content from the email_body.txt file to the recipient email address.

Sending an Email with Cc and Bcc using mutt

Terminal window
echo "Body of the email" | mutt -s "Subject Here" -c [email protected] -b [email protected] [email protected]

Sends an email with Cc and Bcc recipients specified along with the main recipient.

Sending HTML Email with mutt

Terminal window
echo "<html><body><h1>Hello</h1></body></html>" | mutt -e "set content_type=text/html" -s "HTML Email Test" [email protected]

Sends an HTML formatted email to the recipient email address.

Sending an Email with Attachments using mutt

Terminal window
echo "Check out the attachments" | mutt -s "Attachments Test" -a file1.txt -a file2.jpg [email protected]

Sends an email with multiple attachments to the recipient email address.

Sending an Email with Multiple Attachments from a Directory with mutt

Terminal window
echo "See the attachments" | mutt -s "Multiple Attachments Test" -A /path/to/attachments_directory/ [email protected]

Sends an email with all the files from a specified directory as attachments to the recipient email address.

Sending an Encrypted Email using mutt

Terminal window
echo "Confidential message" | gpg --encrypt --recipient [email protected] | mutt -s "Encryption Test" [email protected]

Sends an encrypted email message using GNU Privacy Guard (GPG) along with mutt.

How do I configure mutt in Linux?

To configure mutt in Linux, you can create a .muttrc configuration file in your home directory and add your desired settings.

Terminal window
vim ~/.muttrc

How do I send an email using mutt in bash?

To send an email using mutt in bash, you can use the following command:

Terminal window
echo "This is the body of the email" | mutt -s "Subject" [email protected]

How do I list emails in a mailbox using mutt?

To list emails in a mailbox using mutt, you can open mutt and press ? to view the available key bindings for navigation.

Terminal window
mutt
Press ?

How do I open a specific mailbox in mutt?

To open a specific mailbox in mutt, you can specify the mailbox path as an argument when launching mutt.

Terminal window
mutt -f /path/to/mailbox

How do I search for an email in mutt?

To search for an email in mutt, you can press / to enter the search mode and type your search query.

Terminal window
mutt
Press /
Enter search query

How do I reply to an email in mutt?

To reply to an email in mutt, open the email you want to reply to and press r to start composing a reply.

Terminal window
mutt
Open email
Press r

How do I save an email in mutt?

To save an email in mutt, you can press s while viewing the email to save it to a specified folder.

Terminal window
mutt
Open email
Press s

How do I delete an email in mutt?

To delete an email in mutt, you can press d while viewing the email to mark it for deletion.

Terminal window
mutt
Open email
Press d

How do I quit mutt without saving changes?

To quit mutt without saving changes, you can press q to exit mutt without saving any modifications.

Terminal window
mutt
Press q

Applications of the mutt command

  1. Composing and sending emails from the command line
  2. Reading and managing emails in various folders
  3. Viewing attachments in emails
  4. Managing email accounts and configurations
  5. Scripting and automation of email-related tasks