阿里云Centos6.X發郵件遇到的各種問題,cenots郵件服務器故障解答

前言:
新上一臺阿里的云主機,提供web服務,各種環境搭建完成,能夠提供服務,沒想到在最后的監控環節遇到各種發郵件的坑,這里分享給大家,你是否也遇到這種坑?
網易163免費郵箱相關服務器信息:

阿里云Centos6.X發郵件遇到的各種問題,cenots郵件服務器故障解答


一、安裝和配置:
1.1、安裝
[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 kB00:00epel| 3.2 kB00:00epel/primary| 3.2 MB00:00epel12521/12521extras| 3.4 kB00:00icehouse| 2.9 kB00:00updates| 3.4 kB00:00updates/primary_| 1.2 MB00:00Package mailx-12.4-8.el6_6.x86_64 already installed and latest versionNothing to do1.2、配置(以163郵箱為例)
首先你的郵箱要支持你的需求,到郵箱里去配置
 
阿里云Centos6.X發郵件遇到的各種問題,cenots郵件服務器故障解答


阿里云Centos6.X發郵件遇到的各種問題,cenots郵件服務器故障解答



阿里云Centos6.X發郵件遇到的各種問題,cenots郵件服務器故障解答


然后到/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” admin@163.com
至此應該是沒問題,但是就是收不到郵件 。得了,開始排錯!所有的網絡、配置檢查完成后,還是收不到郵件,最后檢查到端口發現問題?。。?br />
[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
原來服務器根本就不能和第三方郵箱建立連接,問題找到,開始處理,一查才知道阿里云服務器把25端口給封了,需要申請解封 。好吧!登錄管理控制臺,開始申請!??!
阿里云Centos6.X發郵件遇到的各種問題,cenots郵件服務器故障解答


阿里云Centos6.X發郵件遇到的各種問題,cenots郵件服務器故障解答



阿里云Centos6.X發郵件遇到的各種問題,cenots郵件服務器故障解答


 
阿里云的審核速度還挺快的,兩個多小時后反饋結果了,不過看看就吐口老血?。?!
阿里云Centos6.X發郵件遇到的各種問題,cenots郵件服務器故障解答


 
只能想其他的辦法唄?。∽詈鬀Q定使用163郵箱的465加密端口
[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!
看樣子有戲哦?。?!修改/etc/mail.rc的配置
set from=admin@163.com
set smtp="smtps://smtp.163.com:465"
set smtp-auth-user=admin@163.com

推薦閱讀