How to use postfix to send emails in centos7

王林
Release: 2020-04-02 10:49:06
Original
3196 people have browsed it

How to use postfix to send emails in centos7

1. Configure hosts mapping

How to use postfix to send emails in centos7

2. Install Postfix and Mailx tools

[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
Copy after login

3. Define Postfix Configuration file

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

4. Apply for 163 email certificate

[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
Copy after login

5. Use 163 mailbox to send email

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

6. Restart the service and send test email

[root@mail ~]# systemctl restart postfix
[root@mail ~]# echo "This is a test mail" | mail -s '邮件测试' 452666750@qq.com
Copy after login

7. Confirm receipt of email

Recommended related tutorials: centos tutorial

The above is the detailed content of How to use postfix to send emails in centos7. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!