Using msmtp to send emails via scripts such as sedmail and postfix is to configure the server as an email server, while msmtp is equivalent to a mail client (foxmail, outlook, and other clients ), we can apply for an email account from Netease and set it through simple configuration. Install. Wget http://pkgs.fedoraproject.org/repo/pkgs/msmtp/msmtp-1.4.29.tar.bz2/87cc6f37cb7a163ceb89382932e41535/msmtp-1.4.29.tar.bz2 tar xvf msmtp-1.4.29.tar.bz2cd msmtp-1.4.29./configure -- prefix =/usr/local/msmtpmake & make install configuration. Mkdir/usr/local/msmtp/etc/use vi to open the msmtprc file and enter the following content (vi/usr/local/msmtp/etc/msmtprc) defaultsaccount jackhost smtp.163.com # Netease smtp server, you can also select another mailbox server and account domain 163. comfrom jack@163.com # corresponding mailbox account auth loginuser jack@163.compassword jack123 # corresponding password account default: jack was installed here you can use msmtp, however, you can only display the subject and sender of an email by using msmtp, but the content is blank (the reason is to be found). Therefore, you can use mutt to reference msmtp to send emails. In general, mutt is installed by default. If it is not installed in the system, you can install it using yum-y install mutt. Open the mutt configuration file and modify the following four items (vi/etc/Muttrc ). 1. set sendmail = "/usr/local/msmtp/bin/msmtp" 2.set use_from = yes3.set realname = jack@163.com # The mailbox account 4.set editor = "vi" configured above is now, we can test the command to send an email. Echo "Mail content" | mutt-s "mail subject" jack@163.com or you can write the mail content in the file: cat file.txt | mutt-s "mail subject" jack@163.com uses the mutt command in the script to enable automatic mail sending.