Send an attachment and html text both in the same mail

Hi all,

I am working on UNIX (Solaris28). I would like to send an email in which the body will be in html format and, in the same mail, a xls file has to be attached.

I have tried this: the file is correctly attached but the body comes as html source and not formatted. If I do not attach the file (I remove the "uuencode file.xls file.xls"), then theI receive the correct body format (the html is correctly formatted)

cat /tmp/body.html ; uuencode file.xls file.xls ) | /usr/lib/sendmail -t "myname@mydomain.com"

The body.html file contains the following text:
From: myname2@mydomain.com
Content-Type: text/html
Content-Transfer-Encoding: 7bit

<html>
<head>
<title>Title of page</title>
</head>
<body>
This is my first homepage. <b>This text is bold</b>
</body>
</html>

I need to use the standard UNIX command : sendmail or mutt or mailx...
Any help would be greatly appreciated... asap please :wink:
Stefan.

No idea from anyone ?? :confused:

Just a guess, but have you tried uuencoding the file first?

{
  uuencode file.xls file.xls
  cat /tmp/body.html
} | /usr/lib/sendmail -t "myname@mydomain.com"

echo "From: $LOGNAME\nTo: $MAILTO\nSubject: $SUBJECT\n" > ${Mail_File}
echo "${Email Body}\n Regards,\n$LOGNAME" >> ${Mail_File}
uuencode ${FileToSend} "Error Log.txt" >> ${Mail_File}
/usr/lib/sendmail -t -oi < ${Mail_File}

first echo will assign, TO,Subject and From in the email header
Second echo would create the body of the email.
last uuencode would attach the file to the email
${FileToSend} is the file you want to attach
and "Error Log.txt" is the file name that would be dispalyed in the attachement

Fianlly sendmail will send the email with body and specified attachment.

--Manish Jha

Please refer to my reply to this thread in Advanced Users forum here.
Maybe it can help u.

Thanks
Amruta Pitkar