html format email with attachment in unix

Team,

I have the below code, which is working fine and it sends the html report using sendmail command.

I want to attach one more file ( which goes as attachment ) in that email. How to achieve it.

i tried with uuencode. But no luck :mad:

 
outputFile="/tmp/out.html"  
(  
echo "From: abc@abc.com"  
echo "To: abc@abc.com"  
echo "MIME-Version: 1.0"  
echo "Subject: Test"   
echo "Content-Type: text/html"   
cat $outputFile  
) | sendmail -t

try this..

outputFile="/tmp/out.html"  
attachFile="/tmp/attach.html"
(
echo "From: abc@abc.com" 
echo "To: abc@abc.com"
echo "Subject: Test"
echo "Mime-Version: 1.0"
echo 'Content-Type: multipart/mixed; boundary="GvXjxJ+pjyke8COw"'
echo "Content-Disposition: inline" 
echo "" 
echo "--GvXjxJ+pjyke8COw" 
echo "Content-Type: text/html"
echo "Content-Disposition: inline"
cat $outputFile
echo "" 
echo "--GvXjxJ+pjyke8COw"
echo "Content-Type: text/plain"
echo "Content-Disposition: attachement; filename=attachment_filename.html"
echo "" 
cat $attachFile
) | /usr/lib/sendmail -t
3 Likes

Thanks jay, will check and let u know