Mutt is a
free and open-source software package that serves as a
text-based
email
client program for Unix-like
operating systems, such as Linux, though it is also available for
Microsoft Windows systems through the
Unixmail for Windows
package, which also provides
Fetchmail,
Aspell/Pspell,
sSMTP, and
GNU Privacy Guard (GnuPG or GPG). After installing mutt, you can
obtain the text-based interface by typing mutt
. You can
also use command-line interface (CLI) options with mutt to
send email from a shell or command prompt interface. E.g., you can specify
the subject on the command line by using the -s
option followed
by the subject in quotes, e.g., the following command could be used to
send an email message with the subject of "Test Message" to
john.doe@example.com:
$ mutt -s "Test Message" john.doe@example.com
When you enter the command, you will see "To: john.doe@example.com" appear.
You can then hit enter and "Subject: Test Message" would appear. If you hit
Enter then, you will get a
vi editor
(presuming that is the default
text
editor) screen where you can type the text for the body of
the message. You can then hit the i
or a
keys to
start inserting text in the message. When you've finished typing the contents
of the body of the message, you can hit the colon key, i.e., :
and type wq
to exit text insertion mode and save the contents of
the message. You will then see the mutt email composition display and can hit
y
to send the email to the recipient. If you want so send a
canned message you've already saved on the system, you can specify the file
containing the message to be used for the body of the message on the
command line with the
input redirection operator, which is the less than sign,
i.e., <
. That allows you to automate message transmissions
from a script. E.g.:
$ mutt -s "Test Message" john.doe@example.com < theMessage.txt
You can also change the email address that recipients will see to be something other than the default one for the account you are using. E.g., suppose I wanted the "from" address for the message to be samantha.carter@example.com. I could use the command below:
# mutt -e 'my_hdr From:samantha.carter@example.com' -s "Test Message" john.doe@example.com < theMessage.txt #
You can include a space between the "From:" and the email address if
you like. In the above case, I sent the email from the root account on the
system. The "from" address I saw for the mesage in the recipient's inbox was
root <samantha.carter@example.com>
If I want to change the
"realname" shown in the "from" address to be Samantha, insted of root, I
could use the command below:
# mutt -e 'my_hdr From:Samantha <samantha.carter@example.com>' -s "2nd Test Message from Samantha" john.doe@example.com < theMessage.txt #
The recipient would then see Samantha <samantha.carter@moonpoint.com>
for the "from" address of the message.
You can include carbon copy addresses using the -c
option.
E.g.:
# mutt -e 'my_hdr From:Samantha <samantha.carter@moonpoint.com>' -s "3rd Test Message from Samantha" -c john.doe@example.com sally.smith@example.com < theMessage.txt #
You can use -b email_address
to specify a blind-carbon-copy
(BCC) recipient.
Related articles:
References: