阿里雲ECS使用465端口發送郵件

企業 zabbix server遷移到阿里雲服務器,遷移過程中發現郵件告警功能無法使用。特記錄下解決過程,
備註:阿里雲默認是關閉25端口的,使用25端口需要申請,要一天時間,等不了那麼久。就使用465加密端口發送郵件,以下是實施過程。

  1. 安裝mailx
    yum -y install mailx

騰訊企業郵箱配置

vim /etc/mail.rc
set [email protected]
set smtp=smtps://smtp.exmail.qq.com:465
set [email protected]
set smtp-auth-password=xxxxxx
set smtp-auth=login
set ssl-verify=ignore
set nss-config-dir=/etc/pki/nssdb

生成證書

echo -n | openssl s_client -connect smtp.qq.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /etc/pki/nssdb/qq.crt 
certutil -A -n "GeoTrust SSL CA" -t "C,," -d /etc/pki/nssdb/ -i /etc/pki/nssdb/qq.crt 
certutil -A -n "GeoTrust Global CA" -t "C,," -d /etc/pki/nssdb/ -i /etc/pki/nssdb/qq.crt 
certutil -L -d /etc/pki/nssdb/ 
certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i qq.crt #認證
同樣,認證完會返回如下提示:
Notice: Trust flag u is set automatically if the private key is present.

測試發送郵件

echo "test "|mail -v -s "test"  [email protected]
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章