#!/bin/ksh
SUBJECT="Subject Email"
SENDER=sender@mail.co.id
TO="recipient-to@mail.co.id"
CC="recipient-cc@mail.co.id"
BCC="recipient-bcc@mail.co.id"
SPOOLFILE=${DIR_HOME}/list.txt
#if the attach file from query
#echo "Produce listing from SQL*Plus..."
#sqlplus -s scott/tiger >$SPOOLFILE <<-eof font="">-eof>
#set echo off feed off veri off pages 0 head off
#select * from tab;
#EOF
# echo "Convert file to DOS mode..."
# unix2dos $SPOOLFILE $SPOOLFILE 2>/dev/null
echo "Send the E-mail message..."
#(cat body.txt;uuencode /tmp/myattach.txt myattach.txt) | /usr/bin/mailx -s${SUBJECT} -r"indragun@xl.co.id" -c${CC} -b${BCC} ${TO}
(cat body.txt;uuencode ${SPOOLFILE} list.txt) | /usr/bin/mailx -s "Subject Email" -r${SENDER} -c${CC} -b${BCC} ${TO}
# if the body mail is HTML
/bin/mailx -s "Subject Mail
MIME-Version: 1.0
Content-Type: text/html" -r${SENDER} -c${CC} -b${BCC} ${TO} < body.html >> logfile.log
echo "Done!"