首先安装发送邮件需要的包
yum -y install mailx
#!/bin/bash
source /etc/profile
function send_mail(){
maillist=(
28538778798@qq.com
)
DATE=`date +'%F %T'`
SUBJECT="主题"
CONTENT="内容"
for mail in ${maillist[*]};do
echo -e "${CONTENT}" | mail -s "${SUBJECT}" $mail
done
}
send_mail