Sending HTML mail via sendmail cli

Here’s how to do it

1# ( cat <<HEADERS; cat /root/file.html) | sendmail -oi -t
2From: sender@domain.tld
3To: recipients@domain.tld
4Subject: we send HTML instead of plain text
5Mime-Version: 1.0
6Content-type: text/html
7Content-transfer-encoding: 8bit
8 
9HEADERS <- type CTRL+D then press ENTER

We should set Mime-Version , Content-Transfer-Encoding and Content-Type headers properly. The issue of correct MIME transfer encoding is one of the many possible complexities which is simply ignored here.