sendmail function

Hi all,

Following is the code for sending mail with attachment

#! /bin/ksh

SUBJ="Send mail from Unix PHDCAP12 "
TO=tmp@rediff.com
CC=tmp1@rediff.com
(
cat << !
To : ${TO}
Subject : ${SUBJ}
Cc : ${CC}
!

cat << !
HOPE THIS WORKS Test123
This sample E-mail message with the Unix sendmail utility.
!

#uuencode ${1} ${1}
!

) | /usr/lib/sendmail -v ${TO} ${CC}

====
here even after changing the to and cc adresses the mail is still going to the same address mentioned for the first time.Can nyone help

I normally create the Header ( From, To, Cc, Sub) and then use sendmail -t option to send it.. then I do not need to specify the recepients to sendmail.. sendmail reads the message for recepients and sends it across..

(
cat << !
FROM : $FROM
To : $TO
Subject : ${SUB}
Cc : ${CC}
!

cat << !
HOPE THIS WORKS Test123
This sample E-mail message with the Unix sendmail utility.
!

#uuencode ${1} ${1}
!

) | /usr/lib/sendmail -vt