# 发出邮件地址 set from=example@qq.com # smtp配置,与上面对应 # 通常不使用ssl,smtp使用25端口,配置采用下面的即可 # 使用ssl,smtp使用465端口,配置要改为 stmps://smtp.qq.com set smtp=smtp.qq.com set smtp-auth-user=example@qq.com set smtp-auth-password=************** set smtp-auth=login # 如果要用ssl就要加上下面的 set ssl-verify=ignore set nss-config-dir=/root/.certs
证书配置
使用ssl,必须要配置证书
1 2 3 4 5 6
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 -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ~/.certs/./ -i qq.crt certutil -L -d /root/.certs
测试
1
echo "This is the mail body" | mail -a /home/wnh/apps/spring/application.properties -s "Subject" wnhyang@139.com
补上
要定时的脚本
1 2 3 4 5 6 7 8
info="This is the mail body\n磁盘使用情况:\n`df -h`\n内存使用情况:\n`free -h`进程运行情况:\n`top -n 1`"
zip -r /home/wnh/linux_bak.zip /home/wnh/script /home/wnh/mail /home/wnh/apps