Unix Linux Script to Attach and Embed the HTML File in Mail Body

(
export ATTACH="/home/sthomas/xyz.html"
export MAILPART=`uuidgen` ## Generates Unique ID
export MAILPART_BODY=`uuidgen` ## Generates Unique ID
export SUBJECT=”Attach And Embed HTML”

echo "To: $MAILTO"
echo "Subject: $SUBJECT"
echo "MIME-Version: 1.0"

echo "Content-Type: multipart/mixed; boundary=\"$MAILPART\""
echo ""
echo "--$MAILPART"
echo "Content-Type: multipart/alternative; boundary=\"$MAILPART_BODY\""
echo ""
echo "--$MAILPART_BODY"
echo "Content-Type: text/html; charset=us-ascii"
cat $ATTACH
echo "Content-Type: text/html; charset=us-ascii"
echo "Content-Disposition: inline"
echo "--$MAILPART"
echo 'Content-Type: text/html; '
echo "Content-Transfer-Encoding: uuencode"
echo 'Content-Disposition: attachment; filename="'$(basename $ATTACH)'"'
echo ""
uuencode $ATTACH $ATTACH
echo "--$MAILPART--"
) > PRINT_NAME

cat PRINT_NAME| /usr/sbin/sendmail $MAILTO
DBA Tips Data Pump Reference

0 comments:

Post a Comment

 

dba topics. Copyright 2011-16 All Rights Reserved | Site Map | Contact | Disclaimer | Google