#开启postfix
service postfix start
【配置mail.rc】
vim /etc/mail.rc
set from=你的邮箱名@qq.com set smtp=smtps://smtp.qq.com set smtp-auth-user=你的用户名 set smtp-auth-password=你的授权码(不是邮箱密码) set smtp-auth=login set ssl-verify=ignore
【创建认证】
mkdir -p ~/.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 ~/.certs cd ~/.certs certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i qq.crt echo -n | openssl s_client -connect smtp.qiye.aliyun.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/qiye.aliyun.com.crt certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/qiye.aliyun.com.crt certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/qiye.aliyun.com.crt
certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i qiye.aliyun.com.crt
【安装mailx】
yum -y install mailx
【 查看证书文件】
[root@*** .certs]# ll
total 84
-rw-r--r-- 1 root root 65536 Apr 14 10:58 cert8.db
-rw-r--r-- 1 root root 16384 Apr 14 10:58 key3.db
-rw-r--r-- 1 root root 2281 Apr 11 22:22 qiye.aliyun.com.crt
-rw-r--r-- 1 root root 2529 Apr 11 22:06 qq.crt
-rw-r--r-- 1 root root 16384 Apr 11 21:16 secmod.db
修改完成以后测试:瞬间收到邮件
echo "hello word" | mail -s "title" *********@qq.com