centos7怎么使用postfix发送邮件

centos7怎么使用postfix发送邮件,第1张

centos7怎么使用postfix发送邮件

1、配置hosts映射

2、安装Postfix与Mailx工具

[root@mail ~]# yum -y install postfix mailx
[root@mail ~]# systemctl start postfix
[root@mail ~]# systemctl enable postfix
[root@mail ~]# netstat -anput | grep 25
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      1820/master

3、定义Postfix配置文件

[root@mail ~]# vim /etc/postfix/main.cf
myhostname = mail.mds.com
mydomain = mds.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname,$mydomain

4、申请163邮件证书

[root@mail ~]# mkdir /root/.certs
[root@mail ~]# echo -n | openssl s_client -connect smtp.163.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/163.crt
[root@mail ~]# certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/163.crt
[root@mail ~]# certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/163.crt
[root@mail ~]# certutil -L -d /root/.certs
[root@mail ~]# certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ~/.certs/ -i ~/.certs/163.crt

5、借用163邮箱发送邮件

[root@mail ~]# vim /etc/mail.rc
set ssl-verify="ignore"
set smtp-auth="login"
set from="[email protected]"
set smtp="smtps://smtp.163.com:465"
set smtp-auth-user="[email protected]"
set smtp-auth-password="123456"
set nss-config-dir="/root/.certs"

6、重启服务并发送测试邮件

[root@mail ~]# systemctl restart postfix
[root@mail ~]# echo "This is a test mail" | mail -s '邮件测试' [email protected]

7、确认接收邮件

相关教程推荐:centos教程

以上就是centos7怎么使用postfix发送邮件的详细内容,

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/711896.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-24
下一篇 2022-04-24

发表评论

登录后才能评论

评论列表(0条)

保存