How to send a html email with the bash command "sendmail"?

linux, sendmail

Solution

The following works:

(
echo "From: ${from}";
echo "To: ${to}";
echo "Subject: ${subject}";
echo "Content-Type: text/html";
echo "MIME-Version: 1.0";
echo "";
echo "${message}";
) | sendmail -t

For troubleshooting msmtp, which is compatible with `sendmail`, see:

- https://wiki.archlinux.org/index.php/Msmtp

- https://superuser.com/a/868900/9067

Problem

Anyone has a demo available? Sendmail is said to be not scalable,but it's free,so I decided to use it first for now:)

Original source