服務器使用阿里雲安裝的CentOS7, 配置外部郵件服務器,使用mail命令發送郵件
- 使用管理員賬號編輯/etc/mail.rc,添加如下配置:
set [email protected]
set smtp=smtp.163.com
set [email protected]
set smtp-auth-password=xxxx
set smtp-auth=login - 使用mail命令發送郵件:
echo "郵件內容"|mail -s 標題 [email protected] mail -s 標題 [email protected] < file