How can I send an HTML email using a shell script?
The tags include 'sendmail' so here's a solution using that:
(
echo "From: me@xyz.com "
echo "To: them@xyz.com "
echo "MIME-Version: 1.0"
echo "Content-Type: multipart/alternative; "
echo ' boundary="some.unique.value.ABC123/server.xyz.com"'
echo "Subject: Test HTML e-mail."
echo ""
echo "This is a MIME-encapsulated message"
echo ""
echo "--some.unique.value.ABC123/server.xyz.com"
echo "Content-Type: text/html"
echo ""
echo "
HTML E-mail
Click Here
"
echo "------some.unique.value.ABC123/server.xyz.com--"
) | sendmail -t
A wrapper for sendmail can make this job easier, for example, mutt:
mutt -e 'set content_type="text/html"' me@mydomain.com -s "subject" < message.html