I am trying to follow the steps below. But there is no sendEmail on CentOS 7. I have looked at a few alternatives like Postfix, but I am not sure of the script commands.

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

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


You should install mailx (yum install mailx).

It looks like you can probably replace the script with this:

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" \

Consider using port 587 (submission) for such messages if they are always delivered directly to the delivery MTA (i.e. the last one). Otherwise, check out the manpage for ways to use STARTTLS to protect your password.

The example writers should feel shame for not quoting their shell variables...

I think centos puts mailx at /bin/mailx, but it might also be in /usr/bin/mailx.

  • thanks, unfortunately I did not get an email trhough. trying to debug now. – GodAtum Sep 2 '15 at 9:58

Sendemail is a Perl script, so it is easy to install anywhere there is Perl. The upstream URL is http://www.caspian.dotconf.net/menu/Software/SendEmail/, and they have prepacaged rpms. It has nothing to do with Postfix.


I assume that your 'sendEmail' is just Sendmail. Postfix has its own /usr/sbin/sendmail binary, which should work with pretty much any sendmail-compatible package.

As I see, you want to forward your mail to a remote SMTP server. Zabbix natively supports SMTP connectivity, so why not use the built-in mechanism instead of calling the sendmail binary?

  • The 2.x release of Zabbix don't support SMTP authentication. – HBruijn Aug 29 '15 at 7:40

For CentOs, the combination of postfix and sendemail works well. Remember to start the postfix service before you sendemail.

To stay safe, please ensure

mynetworks_style = host

in /etc/postfix/main.cnf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.