简单写的一键脚本,只需要输入邮箱和授权码就可配置mail发送邮件
#!/bin/bash
CHECK() (
echo "set from="$youxiang"
set smtp=smtps://smtp.qq.com:465
set smtp-auth=login
set smtp-auth-user="$youxiang"
set smtp-auth-password="$manman"
set ssl-verify=ignore
set nss-config-dir=/root/.certs" >> /etc/mail.rc
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
)
read -p "QQ邮箱:" youxiang
read -p "授权码:" manman
itfa=$(cat /etc/mail.rc | grep nss-config-dir=/root/.certs | tr -s " " |cut -d" " -f2)
if [ "$itfa"x == "nss-config-dir=/root/.certs"x ];then
echo "当前已配置"
else
CHECK
fi