1. Install msmtp
Download msmtp: http://jaist.dl.sourceforge.net/project/msmtp/msmtp/1.6.5/msmtp-1.6.5.tar.xz
Because the file format is xz, the decompression method is:
# Xz-d msmtp-1.6.5.tar.xz
# Tar xvf msmtp-1.6.5.tar
# Cd msmtp-1.6.5
#./Configure -- prefix =/user/local/msmtp
# Make
# Make install
#/Usr/local/msmtp/bin/msmtp-P # Check the path of the configuration file. The configuration file for Centos7 is created under/usr/local/etc, centos6.x create an msmtprc file under/usr/local/msmtp/etc/
# Vi/usr/local/etc/msmtprc
Account accountname
Logfile/usr/local/msmtp. log
Host smtp.xxx.com
Port 25
From xxx@xxx.com
Auth login
Tls off
User xxx@xxx.com
Password
Account default: accountname
# Save and exit
#/Usr/local/msmtp/bin/msmtp xxx@xxx.com # test whether mail can be sent
Now, msmtp configuration is complete.
II. Install and configure logwatch
# Yum-y install logwatch
# Whereis logwatch # view the default configuration file/usr/share/logwatch/default. conf in the system folders after logwatch is installed.
# Vi/usr/share/logwatch/default. conf/logwatch. conf # Modify the following parameters:
MailTo = email address of the recipient
MailFrom = who sent
Detail = Low ro Med or High # details of the system log analysis report: simple, moderate, and detailed
Mailer = "/usr/local/msmtp/bin/msmtp-t" # The default value is sendmail, which is changed to the msmtp path.
# Save and exit
#/Usr/share/logwatch/scripts/logwatch. pl -- mailto xxx@xxx.com # test whether the current system log analysis report is sent to a xxx@xxx.com email and check whether it is received. By default, the system sends the report of the previous day, which can be modified in the configuration file.