#! /bin/bash
#-------------------------------------------------------
#utility to print report using s-nail
#-------------------------------------------------------
SUBJECT=$1		#first parameters is the email subject
#-------------------------------------------------------
FROM=root@`dnsdomainname`
CONFIG=/etc/s-nail.conf 

if [ -f $CONFIG ] ; then
  . $CONFIG
  fi
  
if [ -z $MTA_MAIL ] ; then
  echo "MTA_MAIL variable is NOT defined with $CONFIG, exiting!"
  exit 1
  fi

if [ -z "$SUBJECT" ] ; then
  SUBJECT="Undefined!"
else
  shift;
fi

cat -	  |						\
	    s-nail					\
		-s "$SUBJECT"				\
		-S v15-compat				\
		-S smtp-auth="none"			\
		-S smtp-use-starttls			\
		-S tls-verify="ignore"			\
		-S from="$FROM"				\
		-S mta="$MTA_MAIL"			\
		$*
