postfix – CentOS 7上的sendEmail等价物是什么?

我想按照以下步骤操作.但是在 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_sendemail

5) Add the Media to the user (Administration / Users / user in PHP
frontend) Reply With Quote

https://www.zabbix.com/forum/showthread.php?t=1323

您应该安装mailx(yum install mailx).

看起来你可以用这个替换脚本:

#!/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中.

相关文章

Centos下搭建性能监控Spotlight
CentOS 6.3下Strongswan搭建IPSec VPN
在CentOS6.5上安装Skype与QQ
阿里云基于centos6.5主机VPN配置
CentOS 6.3下配置multipah
CentOS安装、配置APR和tomcat-native