#!/bin/sh
# Takes three args
#1 is the hostname
#2 is the service name ( or "host" if it's a host alert )
#3 is the subjectline of the mail we want to send (message body comes on stdin)

SERVER=`echo ${1} | tr '[:upper:]' '[:lower:]'`
SERVICE=`echo ${2} | tr '[:upper:]' '[:lower:]' | tr ' ' '_'`

cat | /usr/bin/mail -s "${3}" "${SERVER}-${SERVICE}@your.nagios.box"

