the codingmerc llc

application programming expert for hire

Zabbix: send eMail through SSMTP

using a script media type. Usually you have to use an unsecured SMTP server to send eMails as action in response to a trigger. I was reluctant to set-up a proxy SMTP server or the like as I was using ssmtp on the server running the zabbix_server instance. I put together a script in


that sends an eMail using my already established mail infrastructure. The script uses the 3 parameters provided to as input for the mail send. In addition, I can use sendmail parameters to make the eMail appear from a zabbix user.


export zabbixemailto="$1"
export zabbixsubject="$2"
export zabbixbody="$3"

echo "$zabbixbody" > /tmp/mymailinput_$$

mail -E -s "$zabbixsubject" $zabbixemailto -- -FZabbix < /tmp/mymailinput_$$ rm /tmp/mymailinput_$$

Next up, all you need to do is to define your custom script as a media type like so:


© 2017 the codingmerc llc