我想按照以下步骤操作.但是在
CentOS 7上没有sendEmail.我已经看了一些像
Postfix这样的替代方案,但我不确定脚本命令.
Alternatively you can use sendEmail.
1) apt-get install sendEmail
2) Create a script “zabbix_sendemail” (chmod 755) in the AlertScriptsPath folder specified by /etc/zabbix/zabbix_server.conf
> #!/bin/sh > > export smtpemailfrom=zabbix@yourdomain.com export zabbixemailto=$1 > export zabbixsubject=$2 export zabbixbody=$3 export > smtpserver=yoursmtpserver.com export smtplogin=smtpuser export > smtppass=smtppassword > > /usr/bin/sendEmail -f $smtpemailfrom -t $zabbixemailto -u > $zabbixsubject -m $zabbixbody -s $smtpserver:25 -xu $smtplogin -xp > $smtppass
3) Set the Action (Configurations / Actions in the PHP frontend)
4) Set the Media Type (Administration / Media types in the PHP
frontend) script to zabbix_sendemail5) Add the Media to the user (Administration / Users / user in PHP
frontend) Reply With Quote
您应该安装mailx(yum install mailx).
原文链接:https://www.f2er.com/centos/373309.html看起来你可以用这个替换脚本:
#!/bin/sh echo "$3" | /bin/mailx \ -r zabbix@yourdomain.example \ -s "$2" \ -S smtp="yoursmtpserver.example:25" \ -S smtp-auth=login \ -S smtp-auth-user="your-user" \ -S smtp-auth-password="your-password" \ "$1"
如果这些消息总是直接发送到传送MTA(即最后一个),请考虑使用端口587(提交).否则,请查看联机帮助页以了解使用STARTTLS保护密码的方法.
示例作者应该因为没有引用它们的shell变量而感到羞耻……
我认为centos将mailx放在/ bin / mailx,但也可能在/usr/bin/mailx中.