Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problems encountered in sending email by Centos

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "how to solve the problems encountered in sending e-mail in Centos". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

NetEase 163Free mailbox related server information:

1. Installation and configuration:

1.1. Installation

[root@linux-node2 ~] # yum install mailx-yloaded plugins: fastestmirror Securitysetting up install processdetermining fastest mirrors * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.combase | 3.7 kb 00:00 epel | 3.2 kb 00:00 epel/primary | 3.2 mb 00:00 epel 12521/12521extras | 3.4 kb 00:00 icehouse | 2.9 kb 00:00updates | 3.4 kb 00:00 updates/primary_ | 1.2 mb 00:00 package mailx-12.4-8.el6_6.x86_64 already installed and latest versionnothing to do

1.2. Configuration (take 163 mailbox as an example)

First of all, your mailbox should support your needs and configure it in the mailbox.

Then add it to the configuration file of / etc/mail.rc

Set from=admin@163.com smtp=smtp.163.com smtp-auth-user=admin smtp-auth-password=xxxxxx smtp-auth=login

[root@linux-node2 ~] # echo "12345" | mail-v-s "test"

There should be no problem so far, but I just can't get the e-mail. Come on, start the wrong line! After all the network and configuration checks are completed, there is still no e-mail, and finally the port is checked to find a problem!

[root@linux-node2 ~] # telnet smtp.163.com 25

Trying 220.181.12.17...

^ c

[root@orcherstrator] # nc-vz-w 1 smtp.163.com 25

Nc: connect to smtp.163.com port 25 (tcp) timed out: operation now in progress

Nc: connect to smtp.163.com port 25 (tcp) timed out: operation now in progress

Nc: connect to smtp.163.com port 25 (tcp) timed out: operation now in progress

Nc: connect to smtp.163.com port 25 (tcp) timed out: operation now in progress

Nc: connect to smtp.163.com port 25 (tcp) timed out: operation now in progress

Nc: connect to smtp.163.com port 25 (tcp) timed out: operation now in progress

Nc: connect to smtp.163.com port 25 (tcp) timed out: operation now in progress

Nc: connect to smtp.163.com port 25 (tcp) timed out: operation now in progress

It turned out that the server could not establish a connection with the third-party mailbox at all. The problem was found and started to be dealt with. It was only after checking that the Ali cloud server blocked port 25 and needed to apply for unblocking. Okay! Log in to the management console and start applying!

Ali Yun's audit speed is quite fast, more than two hours later feedback results, but look at the old blood spit!

We can only think of other ways! Finally decided to use the 465 encrypted port of the 163 mailbox.

[root@orcherstrator ~] # telnet smtp.163.com 465

Trying 220.181.12.14...

Connected to smtp.163.com.

Escape character is'^]'.

^ c

Connection closed by foreign host.

Root@orcherstrator ~] # nc-vz-w 1 smtp.163.com 465

Connection to smtp.163.com 465 port [tcp/urd] succeeded!

It looks like there's a chance! Modify the configuration of / etc/mail.rc

Set from=admin@163.com

Set smtp= "smtps://smtp.163.com:465"

Set smtp-auth-user=admin@163.com

Set smtp-auth-password=xxxxx

Set smtp-auth=login

Set smtp-use-starttls

Set ssl-verify=ignore

Set nss-config-dir=/etc/pki/nssdb/

[root@linux-node2 ~] # echo 'hello' | mail-v-s "test" yueyuancun@163.com

Resolving host smtp.163.com. . . Done.

Connecting to 123.125.50.133. . . Connected.

Error in certificate: peer's certificate issuer is not recognized. # # No peer certificate

Comparing dns name: "* .163.com"

Ssl parameters: cipher=aes-128-gcm, keysize=128, secretkeysize=128

Issuer=cn=geotrust ssl ca-g3 recording geotrust inc.,c=us

Subject=cn=*.163.com,o= "netease (hangzhou) network co., ltd", lingering hangzhouJournal stonezhejiangreignedcn

220 163.com anti-spam gt for coremail system (163com [20141201])

> ehlo linux-node2

250-mail

250-pipelining

250-auth login plain

250-auth=login plain

250-coremail 1uxr2xkj7kg0xki17xgru7i0s8fy2u3uj8cz28x1uuuuu7ic2i0y2ufvhs-cuca0xdruuuuj

250-starttls

250 8bitmime

> auth login

334 dxnlcm5hbwu6

> exvlexvhbmn1bkaxnjmuy29t

334 ugfzc3dvcmq6

> agvsbg9uawhhbze5odkxma==

535 error: authentication failed

Smtp-server: 535 error: authentication failed

"/ root/dead.letter" 11Compact 299

. . . Message not sent. # # email not sent

At this point, the case on the Internet all said that they could receive e-mail, but I just couldn't get it, so solve it according to the error! Get a certificate

[root@linux-node2] # mkdir-p / root/.certs/

[root@linux-node2 ~] # echo-n | openssl s_client-connect smtp.163.com:465 | sed-ne'/-begin certificate-/,/-end certificate-/p' > ~ / .certs/163.crt

Depth=2 c = us, o = geotrust inc., cn = geotrust global ca

Verify return:1

Depth=1 c = us, o = geotrust inc., cn = geotrust ssl ca-G3

Verify return:1

Depth=0 c = cn, st = zhejiang, l = hangzhou, o = "netease (hangzhou) network co., ltd", cn = * .163.com

Verify return:1

Done

[root@linux-node2] # certutil-a-n "geotrust ssl ca"-t "c certs/163.crt,"-d ~ /. Certs-I ~ /.

[root@linux-node2] # certutil-a-n "geotrust global ca"-t "c certs/163.crt,"-d ~ /. Certs-I ~ /.

[root@linux-node2] # certutil-l-d / root/.certs

Certificate nickname trust attributes

Ssl,s/mime,jar/xpi

Geotrust ssl ca c

[root@linux-node2 ~] # cd / root/.certs/

[root@linux-node2. 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.

[root@linux-node2 .certs] # cd

[root@linux-node2 ~] # vim / etc/mail.rc

Set from=admin@163.com

Set smtp= "smtps://smtp.163.com:465"

Set smtp-auth-user=admin@163.com

Set smtp-auth-password=xxxxx

Set smtp-auth=login

Set smtp-use-starttls

Set ssl-verify=ignore

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

[root@linux-node2 ~] # echo 'hello' | mail-v-s "test" admin@163.com

Resolving host smtp.163.com. . . Done.

Connecting to 123.125.50.132. . . Connected.

Comparing dns name: "* .163.com"

Ssl parameters: cipher=aes-128-gcm, keysize=128, secretkeysize=128

Issuer=cn=geotrust ssl ca-g3 recording geotrust inc.,c=us

Subject=cn=*.163.com,o= "netease (hangzhou) network co., ltd", lingering hangzhouJournal stonezhejiangreignedcn

220 163.com anti-spam gt for coremail system (163com [20141201])

> ehlo linux-node2

250-mail

250-pipelining

250-auth login plain

250-auth=login plain

250-coremail 1uxr2xkj7kg0xki17xgru7i0s8fy2u3uj8cz28x1uuuuu7ic2i0y2uf6b612uca0xdruuuuj

250-starttls

250 8bitmime

> auth login

334 dxnlcm5hbwu6

> exvlexvhbmn1bkaxnjmuy29t

334 ugfzc3dvcmq6

> agvsbg9uawhhbze5odk=

235 authentication successful

> mail from:

250 mail ok

> rcpt to:

250 mail ok

> data

354 end data with.

>.

250 mail ok queued as smtp2,dngowadh53ejp5bbgyuhaa--.2s2 1536206732

> quit

221 bye

Finally succeeded!

This is the end of the content of "how to solve the problems encountered in sending email by Centos". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report