一、安裝mailx郵件用戶端:
yum install mailx -y
二、修改/etc/mail.rc配置檔案:
set ssl-verify=ignore
set nss-config-dir=/root/.certs
set smtp=smtps://smtp.qq.com:465
set smtp-auth-password=qq郵箱授權碼
set smpt-auth=login
三、配置證書:
mkdir -p /root/.certs/
echo -n | openssl s_client -connect smtp.qq.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/qq.crt
certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/qq.crt
certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/qq.crt
certutil -L -d /root/.certs
四、在自己的qq郵箱擷取授權碼:

把生成的授權碼複制粘貼到第二步set smtp-auth-password=即可。
五、最後發送郵件:
echo "i am victor chen,hi" | mail -v -s "say hello" [email protected]