First, let's introduce the mutt software. It is a text-interface-based mail client, which is very small but powerful. It can be used to read and write, reply, save, and delete your emails, it can send and receive email attachments in linux Command Line Mode.
I only talk about a small part of it, because I just started to explore this software. For more usage please refer to the official website: http://www.mutt.org
1. Install mutt
Yum-y install sendmail 2 # install sendmail and enable port 25 of the firewall. If you need to receive mail from port 110, enable 3 yum-y install mutt.
Ii. configuration information
One thing to note about the configuration information is that many tutorials on the Internet say, edit/root /. muttrc to modify the configuration file. What I want to say is that after the installation is complete, the/root directory does not exist. muttrc: a hidden file. You can copy it from other places or create a new file by yourself. Here I copied it.
You can use the find command to find the Muttrc file. The command is as follows: find/-name Muttrc, and then run the command cp/etc/Muttrc/root /. copy muttrc to/root and rename it. muttrc, and then you can edit the configuration file.
# If the email you receive is garbled, set the following information: 2 set charset = "UTF-8" 3 set rfc2047_parameters = yes 4 # If you want to customize the sender information, the following settings are required: 5 set envelope_from = yes 6 set use_from = yes 7 set from = root@itdhz.com 8 set realname = "itdhz"
After mutt is installed, you can have a good manual under/usr/share/doc/mutt.
Iii. Email sending
Syntax:
Mutt [-hnpRvxz] [-a <File>] [-B <address>] [-c <address>] [-f <email>] [-F <Configuration file>] [-H <draft email>] [-I <File>] [-m <type>] [-s <topic>] [email address]
Parameters:
-A <File> add an additional file to the email.
-B <address> specifies the recipient address of the BCC copy.
-C <address> specifies the recipient address of the copy.
-F <email file> specifies the email file to be loaded.
-F <Configuration File> specifies the setting file of the mutt program, instead of reading the preset. muttrc file.
-H: displays help.
-H <draft email> sends the specified draft email.
-I <File> Insert the specified file into the email.
-M <type> specifies the preset mail type.
-N do not read the program cultivation file (/etc/Muttrc ).
-P, after editing the email in mutt, does not want to send the email immediately, you can suspend sending the email.
-R: open the mail file in read-only mode.
-S <topic> specifies the subject of the email.
-V displays the version information of mutt and the parameters given when the file was compiled.
-X simulates the editing method of mailx.
When the-z parameter is used together with the-f parameter, if the mail file does not contain the mail, the mutt is not started.
Iv. Examples
Here, I will use a code section of my own website to illustrate
Mutt abc@mail.com-s "itdhz data backup"-a/home/backup/itdhz. SQL </root/readme.txt or echo "test" | mutt abc@mail.com-s "itdhz data backup"-a/home/backup/itdhz. SQL
This Code indicates that the mail is sent to the abc@mail.com mailbox, the subject is "itdhz data backup", the Mail content in/root/readme.txt, the mail contains the attachment/home/backup/itdhz. SQL. To send multiple attachments, add the-a parameter before each attachment.