Aspire

centos 发邮件

发布时间:6年前热度: 2705 ℃评论数:

#创建证书

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


#信任证书

certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu"  -d ./ -i qq.crt 


# 配置/etc/mail.rcE繁忙

set smtp="smtps://smtp.qq.com:465"

set smtp-auth=login

set smtp-auth-user="228444347@qq.com"  #换成你的qq邮箱

set smtp-auth-password="fwmazaxbllqrcajg"  # 换成你的qq邮箱第三方登录密码

set ssl-verify=ignore 

#set nss-config-dir=/etc/pki/nssdb

set nss-config-dir=/root/.certs


说明:

#smtp-auth-password的密码是qq邮箱里面设置的第三方登录密码,不是你qq的密码,在qq邮箱设置界面配置

 

测试:

echo message3 | mail -v -r "228444347@qq.com" -s "hello world" 228444347@qq.com

注意:一定要带-r参数,生产上去掉-v参数




shell 脚本

echo "$(date +%Y%m%d)" | mail -v -r "jiankaikey@163.com" -s "$(date +%Y%m%d)" -a /home/dbback/$(date +%Y%m)/diancan_$(date +%Y%m%d).sql.gz jiankaijack@163.com

源码安装、技术讨论、二次开发等联系微信:

邮件

栏目导航

  1. PHP
  2. Go
  3. Mysql
  4. Linux
  5. 前端
  6. 杂谈

相关文章

  1. 增强bash命令 4367 ℃
  2. git 使用 ssh 4353 ℃
  3. 安装 supervisor 3954 ℃
  4. 性能常用命令 3939 ℃
  5. 文件权限 3620 ℃
  6. rsync 命令 3341 ℃
  7. centos文件共享 3269 ℃
  8. shell解析腾讯云 3242 ℃
  9. crontab使用 3233 ℃
  10. linux zip,tar命令 3155 ℃

手机扫码访问