mutt是一個開源郵件工具,小巧方便,能夠實現簡單郵件功能,在服務器shell
警報中特別經常使用,下面簡單介紹一下使用狀況。vim
日誌經過shell腳本實現,郵件系統使用mutt,發送郵件工具使用msmtp。安全
一、安裝msmtp,配置服務器
wget http://nchc.dl.sourceforge.net/sourceforge/msmtp/msmtp-1.4.17.tar.bz2
tar xvf msmtp-1.4.17.tar.bz2
cd msmtp-1.4.17
./configure --prefix=/usr/local/msmtp
make && make installide
cd /usr/local/msmtp/ # etc配置文件目錄和配置文件都要本身建
vim etc/msmtprc #手動建立配置文件
account default
host smtp.126.com #你的發送郵件服務器
port 25
from shan1987shan@126.com #要從哪一個郵箱發出
auth login 工具
tls off
user shan1987shan #郵箱用戶名
password password #郵箱密碼,若是你以爲不安全能夠把文件改成600屬性
logfile /var/log/mmlog測試
配置完畢進行測試:spa
/usr/local/msmtp/bin/msmtp zhuss@si-tech.com.net
輸入內容,按ctrt+D退出,查看是否收到郵件日誌
二、配置mutt
默認已經安裝了,沒有安裝yum安裝便可
Vi /etc/Muttrc
set sendmail="/usr/local/msmtp/bin/msmtp"
set envelope_from=yes
set from=shan1987shan@126.com
set realname="sitech-zhuss"
set use_from=yes
測試echo "testmail" | mutt -s "測試" -a /etc/hosts zhuss@si-tech.com.cn
三、測試經過運行腳本文件便可
能夠設置一些計劃任務按期將服務器文件傳到郵箱了,簡單吧