#!/bin/sh
#
# Setup who sent and who was supposed to receive all this
#
# There's a lot of parameters here... not much I can do about it :\
#
xamimeid=$1
sender=$2
admin=$3
homedir=$4
reportname=$5
sendmail_bin=$6
sendmail_flags=$7
rfcdate=$8
receivers=$9

server_name=`echo $sender| cut -d@ -f2`

#
# Setup the output file...
#
adminmsg=${homedir}/tmpadminmsg


	#
	# Message to the sender
	#
printf "\
Date: ${rfcdate}\n\
From: ${admin}\n\
To: ${admin}\n\
Subject: Inflex scan report [$xamimeid]\n\
\n\
This email has been sent to you from an email content scanning filter\n\
 located on the server [${server_name}].  If you have any queries relating\n\
 to this email, please direct them to ${admin}.\n\
 \n\
Report Details -----------------------------------------------\n\
Sender: ${sender}\n\
Receiver[s]: ${receivers}\n\
Pack directory: ${homedir}\n\
" >> ${adminmsg}

cat ${reportname} >> ${adminmsg}
printf "\nEnd.\n.\n" >> ${adminmsg}

cat ${adminmsg} | ${sendmail_bin} ${sendmail_flags} "${admin}"
#END
