1. yum -y install sendemail

2.编写函数发送邮件

Sendmail(){
smtp='noticemail.yxit.cc'
account='he@qq.com'
password='123'
to='liu@yx.com'
subject=$1
content=$2
sendemail -f $account -t $to -s $smtp -u $subject -o message-charset=utf8 -xu $account -xp $password -m $content -o tls=no
}

subject=‘sub’
res=‘content’
Sendmail "$subject" "$res"