Shell Sendemail发邮件
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"
发送匿名邮件
Sendmail(){ smtp='10.0.3.3:25' account='liuaa@yx.com' to='liuaa@yx.com' #多个收件人以空格分隔即可 subject=$1 content=$2 sendemail -f $account -t $to -s $smtp -u $subject -o message-charset=utf8 -m $content -o tls=no } subject=‘sub’ res=‘content’ Sendmail "$subject" "$res"