Here is a bash script I use to send reports I generate to people. They are sent as attachments. Place your HTML in the "body" variable of the script. I will leave the parametrization of the variables up to you.
#!/bin/bash
function get_mimetype(){
file --mime-type "$1" | sed 's/.*: //'
}
from="me.last@company.com"
to="some.one@companyBlah.com"
subject="Your Report my Lord"
boundary="=== Boundary ==="
body="The reports are attached to this email"
declare -a attachments
attachments=( "fileOne.out" "fileTwo.out" "fileThree.out" "file-et-cetera.out")
# Build headers
{
printf '%s\n' "From: $from
To: $to
Subject: $subject
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary=\"$boundary\"
--${boundary}
Content-Type: text/plain; charset=\"US-ASCII\"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
$body
"
for file in "${attachments[@]}"; do
[ ! -f "$file" ] && echo "Attachment $file not found, omitting file" >&2 && continue
mimetype=$(get_mimetype "$file")
printf '%s\n' "--${boundary}
Content-Type: $mimetype
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=\"$file\"
"
base64 "$file"
echo
done
# print last boundary with closing --
printf '%s\n' "--${boundary}--"
} | sendmail -t -oi