zabbix 用sendEmail发邮件
vim /usr/lib/zabbix/alertscripts/sendmail.sh
#!/bin/bash
#
to=$1
subject_utf8=$2
body_utf8=$3
# 转换邮件标题为GB2312,解决邮件标题含有中文,收到邮件显示乱码的问题。
subject_gb2312=`iconv -t GB2312 -f UTF-8 << EOF
$subject_utf8
EOF`
[ $? -eq 0 ] && subject="$subject_gb2312" || subject="$subject_utf8"
# 转换邮件内容为GB2312
body_gb2312=`iconv -t GB2312 -f UTF-8 << EOF
$body_utf8
EOF`
[ $? -eq 0 ] && body="$body_gb2312" || body="$body_utf8"
/usr/local/bin/sendEmail -f 'ZABBIX INFORMATION<邮箱>' -t "$to" -s 邮件服务器地址 -u "$subject" -o message-content-type=html -o message-charset=gb2312 -xu '邮箱' -xp 密码 -m "$body" -o tls=no
sendEmail的安装见如下链接
https://blog.csdn.net/xiangliangyu/article/details/82703052