linux16~mailx发邮件带附件

2018.03.20

  • 生成证书
mkdir -p /root/.certs/
echo -n | openssl s_client -connect smtp.exmail.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
certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu"  -d ./ -i ~/.certs/qq.crt
  • 配置/etc/mail.rc
set [email protected]
set smtp="smtps://smtp.qq.com:465"
set [email protected]
set smtp-auth-password=smtp的授权码
set smtp-auth=login
set ssl-verify=ignore
set nss-config-dir=/root/.certs/
  • 发邮件
echo "正文"|mailx -a /home/work/test.jpg -s "主题" [email protected] 

你可能感兴趣的:(linux16~mailx发邮件带附件)