It might work if you change this line:
( cat <<HERE; uuencode "${ATTFILE}" "${ATTNAME}" ) | sendmail -oi -t
to:
( cat <<HERE; < "${ATTFILE}" ) | sendmail -oi -t
I'm not too sure about the order of appearance (either the header or the attachment coomes first, I'm not sure...
Strictly speaking you should also have MIME-Version and Content-Transfer-Encoding headers. MIME-Version is simply 1.0, there has never been any other version; for Content-Transfer-Encoding, 7bit is appropriate if the content is plain 7-bit ASCII text with no long lines (longer than 1024 characters IIRC). (If it's not plain 7-bit ASCII you should also define the character set in Content-Type.)
Some versions of cat will accept standard input as an argument, so you can say
cat - /path/to/file <<HERE | sendmail -oi -t
From: ${MAILFROM}
To: ${MAILTO}
Subject: Same subject
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
HERE