阿里雲 Linux 啟用465端口發送郵件
環境:阿里雲 Linux Centos 7.4 x64
注:阿里雲默認禁用25郵件端口,需要啟動465端口加密進行郵件發送。
注:確保郵箱開啟SMTP服務,POP3,並申請了密碼。
注:確保已經安裝mailx,sendmaill,dos2unix
安裝教程:https://www.cnblogs.com/xiangsikai/p/8441195.html
1、編輯mail配置文件
vim /etc/mail.rc
# 啟動ssl set ssl-verify=ignore # 郵箱賬戶 set from=xxxxxx@126.com # smtp郵箱類型 set smtp="smtps://smtp.126.com:465" # 郵箱賬戶 set smtp-auth-user="xxxxxxx@126.com" # 郵箱授權密碼 set smtp-auth-password=xxxxxxx # login模式 set smtp-auth=login # 指定文件目錄 set nss-config-dir=/etc/pki/nssdb
2、重啟郵箱服務器
systemctl restart sendmail
3、測試發送郵件
# echo 內容 | mail -s "主題" 發送人郵箱地址 echo test | mail -s "test" 136×××@126.com