As a system administrator, sometimes we need to send emails to customers or other people on the server. In this case, we will use a web-based email system to send emails. Is this the most convenient way? Absolutely not.
In this tutorial, we will use the mutt (a terminal email client) command to send emails from the command line.
What is Mutt?
Mutt is a command line-based Email client. It is a very powerful and useful command for sending and reading emails on Unix systems. Mutt also supports receiving emails using POP and IMAP protocols. It provides a color interface to make sending emails from the command line more friendly.
Mutt features
Mutt includes the following features:
- Easy to install and configure
- Emails with attachments can be sent from the command line.
- You can add BCC and CC to an email.
- Message sessions supported
- Displays the email list.
- Multiple email formats are supported, such as maildir, mbox, MH, and MMDF.
- Supports at least 20 languages
- Support for DSN (Delivery Status Notification, Delivery Status Notification)
How to install Mutt on Linux
On Linux, we can easily use any package installer to install the Mutt client, as shown below.
Apt-get install mutt (For Debian/Ubuntu based system)
Yum install mutt (For RHEL/CentOS/Fedora based system)
Configuration File
The configuration file of the Mutt Email client:
- Main Configuration file: The change is global and affects mutt of all users. You can change it through its mail Configuration file "/etc/Muttrc.
- User Configuration file of Mutt: If you want to customize Mutt for a specific User, you can set ~ /. Muttrc or ~ /. Mutt/muttrc.
Basic mutt command syntax
Mutt options recipient
Read emails with Mutt
To read emails from users logged on to the current system, you only need to run "mutt" on the terminal, which will load the current user's mailbox.
Mutt
To read emails from a specified user, you need to tell the program which email file to read. For example, if you (root User) want to view users' "John" emails, you need to use the "-f" option to specify their email files.
Mutt-f/var/spool/mail/john
You can also use the "-R" option to enable read-only mode.