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

omg picture omg · Aug 26, 2009 · Viewed 118k times · Source

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:)

Answer

Steven L picture Steven L · Apr 8, 2013

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: