title: How to send HTML email with attachment with sendmail software in UNIX ksh
body: <p>I'm trying to send HTML email with an attachment but is not working, is just sending the file</p>
  
  <p>the following code works with the HTML:</p>
  
  <pre><code>message="all the HTML message"
  (
     echo "From: UnixMail@test.com";
     echo "To: emails@email.com";
     echo "Subject: Testing HTML with attachment";
     echo "Content-Type: text/html";
     echo "MIME-Version: 1.0";
     echo "";
     echo "${message}";
  ) | /usr/sbin/sendmail -t
  </code></pre>
  
  <p>but I'm trying to add the attachment like this:</p>
  
  <pre><code>message="all the HTML message"
  (
     echo "From: UnixMail@test.com";
     echo "To: emails@email.com";
     echo "Subject: Testing HTML with attachment";
     echo "Content-Type: text/html";
     echo "MIME-Version: 1.0";
     echo "Content-Transfer-Encoding: base64"
     echo "Content-Type: application/octet-stream; name=test_file.txt"
     echo "Content-Disposition: attachment; filename=/directory/myfile"
     echo "";
     echo "${message}";
  ) | /usr/sbin/sendmail -t
  </code></pre>
  
  <p>Is not working, just send the attachment without any readable things... any idea?</p>