CentOS7.x 通過mail命令發,使用465端口(smtps協議)發送郵件


#創建證書
mkdir -p /root/.certs/
echo -n | openssl s_client -connect smtp.qq.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/qq.crt
certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/qq.crt
certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/qq.crt
certutil -L -d /root/.certs
#信任證書
certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu"  -d ./ -i qq.crt 

# 配置/etc/mail.rcE繁忙
set smtp="smtps://smtp.qq.com:465"
set smtp-auth=login
set smtp-auth-user="228444347@qq.com"  #換成你的qq郵箱
set smtp-auth-password="fwmazaxbllqrcajg"  # 換成你的qq郵箱第三方登錄密碼
set ssl-verify=ignore 
#set nss-config-dir=/etc/pki/nssdb
set nss-config-dir=/root/.certs

說明:
#smtp-auth-password的密碼是qq郵箱里面設置的第三方登錄密碼,不是你qq的密碼,在qq郵箱設置界面配置
 
測試:
echo message3 | mail -v -r "228444347@qq.com" -s "hello world" 228444347@qq.com
注意:一定要帶-r參數,生產上去掉-v參數


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM