Currently my code sends an html file within the content of the email. I want to continue sending this email as it currently is being sent BUT i want to include an attachment. So in addition to the html content and attachment which is just a flat file containing some records of data. My current code...
(
echo "To: ${AEGIS_REPORT_DIST_LIST}"
echo "Subject: ${EMAIL_SUB}"
echo "MIME-Version: 1.0"
echo "Content-Type: text/html"
echo ""
cat "${FINAL_HTML_TABLE}"
) | /usr/sbin/sendmail -t
Figured it out myself. Here's what worked....
(
echo "To: ${AEGIS_REPORT_DIST_LIST}"
echo "Subject: ${EMAIL_SUB}"
echo "MIME-Version: 1.0"
echo "Content-Type: multipart/mixed; boundary="MAIL_BOUNDARY""
echo "--MAIL_BOUNDARY"
echo "Content-Type: text/html"
echo ""
cat "${FINAL_HTML_TABLE}"
echo "--MAIL_BOUNDARY"
echo "Content-Type: application/octet-stream; name="$(basename "$NINJA_NON_RESPONSE_RECORDS_FILE_PATH")""
echo "Content-Disposition: attachment; filename="$(basename "$NINJA_NON_RESPONSE_RECORDS_FILE_PATH")""
echo ""
cat ${NINJA_NON_RESPONSE_RECORDS_FILE_PATH}
echo "--MAIL_BOUNDARY--"
) | /usr/sbin/sendmail -t