Unable to send mail with inline html along with attachment. Please help!

The below code is not working. I am able to send only inline html or only attachment. When trying to do both, only inline html is sent without attachment. Please help!

 #!/bin/ksh
 (echo "Subject: Test Mail - HTML Format"
 echo "MIME-Version: 1.0"
 echo "Content-Type: text/html"
 echo "Content-Disposition: inline"
 cat status.html) > stat.html
 uuencode a.txt a.txt | /usr/lib/sendmail asdf@abcd.com < stat.html

By example:

#!/usr/bin/ksh

# http://en.wikipedia.org/wiki/MIME

export MAILTO=aa@aa.aa.ca
export SUBJECT=$0
export BODY=/home/unxsa/bin/miles_tests/html_email_with_attachments.body
export ATTACH=/home/unxsa/bin/miles_tests/cards.txt
EMAIL_BOUNDARY_STRING=Z${RANDOM}${RANDOM}${RANDOM}${RANDOM}

(
 echo "To: $MAILTO"
 echo "Subject: $SUBJECT"
 echo "MIME-Version: 1.0"
 echo 'Content-Type: multipart/mixed; boundary="${EMAIL_BOUNDARY_STRING}"'
 echo '--${EMAIL_BOUNDARY_STRING}'

 echo "Content-Type: text/html"
 echo "Content-Disposition: inline"
 cat $BODY
 echo '--${EMAIL_BOUNDARY_STRING}'

 echo 'Content-Type: application/octet-stream; name="'$(basename $ATTACH)'"'
 echo "Content-Transfer-Encoding: base64"
 echo 'Content-Disposition: attachment; filename="'$(basename $ATTACH)'"'
 uuencode -m $ATTACH $(basename $ATTACH)
 echo '--${EMAIL_BOUNDARY_STRING}'

 echo 'Content-Type: application/octet-stream; name="'$(basename $ATTACH)'"'
 echo "Content-Transfer-Encoding: base64"
 echo 'Content-Disposition: attachment; filename="'$(basename $ATTACH)'"'
 uuencode -m $ATTACH $(basename $ATTACH)

 echo '--${EMAIL_BOUNDARY_STRING}--'

) | /usr/sbin/sendmail $MAILTO