Tuesday, September 26, 2017

Send mail as HTML Format using Shell Script

Use the below script to send the mail as HTML Format using Shell Script.

# Send mail

export MAILTO="abc@xyz.com" ## Mail address
export CONTENT="/var/index.html" ## HTML Path
export SUBJECT="HTML Mail"
(
echo "Subject: $SUBJECT"
echo "MIME-Version: 1.0"
echo "Content-Type: text/html"
echo "Content-Disposition: inline"
cat $CONTENT
) | /usr/sbin/sendmail $MAILTO

fi