1、安裝mailx sendmail安全
1.1查看是否已經安裝bash
yum install -y mailx sendmailspa
若是已經安裝,會提示已經安裝,沒有安裝會自動安裝。code
2、開啓sendmail服務blog
查看狀態:systemctl status sendmailclass
若是Active:顯示active(running)則正常,若是爲dead則啓動服務test
啓動:systemctl start sendmail登錄
3、配置服務/etc/mall.rc,以qq郵箱爲例配置
set from=xxxx@qq.com set smtp=smtp.qq.com set smtp-auth-user=xxx@qq.com set smtp-auth-password=nibpgbkksmlbbabe #不是qq郵箱密碼,是在qq郵箱設置中生成的受權碼
4、發送郵件 密碼
4.1 管道符:
echo "mail test info" | mail -s "mail_test" 123435@qq.com
4.2 文件內容做爲郵件內容:
mail -s "mail_test" 123435@qq.com < /tmp/t.txt
5、QQ受權碼生成