Introduction: When using some shell scripts need to be monitored by sending a reminder alert email below to implement a simple message sent by deploying a simple sendmail.
1, install mailx and sendmail:
yum install mailx -y
yum install sendmail -y
Start: systemctl start sendmail
2, modify the configuration file: vim /etc/mail.rc
= @ ***** from the SET 163 .com #-mail account you want to send the SET the SMTP = the SMTP. 163 .com #-mail server sent the SET the SMTP -auth the User-***** = @ 163 .com #-mail account the SMTP the SET -auth-password = Linux *** # authorization code the SET the SMTP -auth = the Login
3, the transmission method
echo ' content ' | mail -s ' theme ' ***** @ 163 .com
-s mail ' theme ' ***** @ 126 .com <test.txt test.txt # content in the
4, Log Viewer (unable to go, then look at the log)
tail /var/log/maillog
5, error resolved
1) My unqualified host name (bogon) unknown appears in the log; sleeping for retry # can not resolve domain name
Solution: Find Dj $ w vi /etc/mail/sendmail.cf in the configuration file, and add this line below this line
Dj$w.
In the / etc / hosts add the line
Local ip bogon bogon. Note that there is a rearmost point
Restart Service
6, the above configuration file obtaining authorization code (Example 163)