I need to send mail from a linux host with HTML content type and also attach a file to the mail.
cat html_mail.txt
To: me@mydomain.com
Subject: Test Mail
Content-Type: text/html; charset="us-ascii"
Content-Disposition: inline
<span style="background-color:green">This is in green</span>
I tried the below options:
mail:
mail -a attachment_file < html_mail.txt
"mail" command sends an attachment but the HTML content in html_mail.txt is coming up as plain text in the mail
Execution of the command says "Ignoring headers Content-Type".
sendmail:
cat html_mail.txt |sendmail -t
sendmail sends the html content properly, but I couldn't find an option to send an attachment.