$ vim /etc/mail.rc set from=xxx@163.com # 发送邮件后显示的邮件发送方 set smtp=smtps://smtp.163.com:465 # 163 smtp邮件服务器 set smtp-auth-user=youremail@163.com # 你的163邮箱 set smtp-auth-password=xxxxxx # 你的163邮箱密码(设置页面加密后的授权码) set smtp-auth=login # 动作、登录 set nss-config-dir=/root/.certs/ # 证书路径 set ssl-verify=ignore # 忽略ssl验证
三、生成邮箱证书
$ mkdir -p /root/.certs/ $ echo -n | openssl s_client -connect smtp.163.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/163.crt $ certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/163.crt $ certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/163.crt $ certutil -L -d /root/.certs $ cd /root/.certs/ $ certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i 163.crt
注意:
出现 下面提示说明正常
Notice: Trust flag u is set automatically if the private key is present.
四、测试发送邮件
$ echo"This is a test mail." | mail -s "Test Mail" -a test.txt youremail@163.com
注意:
echo 的为邮件内容,-s 是邮件主题,-a 为添加附件,逗号分隔多个邮箱地址。
腾讯 QQ 邮箱
一、安装服务软件
安装 mailx、sendmail 软件
$ yum install -y mailx sendmail
二、配置修改
$ vim /etc/mail.rc set from=xxx@qq.com # 发送邮件后显示的邮件发送方 set smtp=smtps://smtp.qq.com:465 # qq smtp邮件服务器 set smtp-auth-user=youremail@qq.com # 你的 qq 邮箱 set smtp-auth-password=xxxxxx # 你的 qq 邮箱密码(设置页面加密后的授权码) set smtp-auth=login # 动作、登录 set nss-config-dir=/root/.certs/ # 证书路径 set ssl-verify=ignore # 忽略ssl验证
三、生成邮箱证书
$ 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 $ cd /root/.certs/ $ certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i qq.crt
注意:
出现 下面提示说明正常
Notice: Trust flag u is set automatically if the private key is present.
四、测试发送邮件
$ echo"This is a test mail." | mail -s "Test Mail" -a test.txt youremail@qq.com