1.centos安裝mailx
yum install -y mailx
安裝之後編輯/etc/mail.rc
使用163郵箱,在文件末尾加上以下內容完成配置
set bsdcompat
set [email protected]
set smtp=smtp.163.com
set smtp-auth-user=chao
set smtp-auth-password=931
set smtp-auth=login
用法
給[email protected]發送郵件
echo "內容" |mailx -s "標題" [email protected]
驗證是否安裝完成