daysomeon
0.环境准备
修改hosts文件
127.0.0.1 localhost.localdomain localhost 主机名
127.0.0.1 主机名
 
1.需要用到的软件包:sendmail,mailx
两者直接用yum安装即可
    
yum -y install sendmail mailx
 
2.开启163邮箱smtp服务,设置授权码
 
3.配置mailx配置文件,直接在尾部加入配置
vi /eta/mail.rc
set from=xxx@163.com    #设置发件人,这个可以随意填写,建议和邮箱一致
set smtp=smtps://smtp.163.com:465    
set smtp-auth-user=xxx@163.com    #设置邮箱
set smtp-auth-password=xxx        #设置授权码
set smtp-auth=login                    
set nss-config-dir=/root/.certs/
set ssl-verify=ignore
 
4.配置证书
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.
 
5.启动服务,发送邮件
systemctl start sendmail
echo 内容 | mailx -s \'标题\' 接收人邮箱
 
注意!!
mailx -v 选项可以查看执行过程,对排错很有用!
 

分类:

技术点:

相关文章:

  • 2021-08-20
  • 2021-12-14
  • 2021-08-07
  • 2021-08-12
  • 2021-12-22
  • 2022-01-02
  • 2021-12-04
猜你喜欢
  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
  • 2021-12-29
  • 2021-12-14
  • 2021-07-22
  • 2021-10-30
相关资源
相似解决方案