title: Send email from UNIX command with attachment and HTML message body
body: <p>This may sound like a dumb question, but I have tried and searched a lot of options, and none met my requirements</p>
  
  <p>I am trying to send a mail with a report from unix command line using a bash script, I managed to send it with body and attachment using the mailx service, but the body is unformatted and not pleasing to the eye</p>
  
  <pre><code>(echo "$(cat /tmp/report_summary.html)";uuencode /tmp/report_details.xls report_details.xls) |/usr/bin/mailx -s "Report for XYZ" $MAIL_GRP
  </code></pre>
  
  <p>I tried the sendmail option, which formats the message body perfectly, but does not have an option for attachment</p>
  
  <pre><code>(
  echo "From: From@xyz.vom";
  echo "To: Address@xyz.vom";
  echo "Subject: Test Message 1 2 3";
  echo "Content-Type: text/html";
  echo "MIME-Version: 1.0";
  echo "Content-Disposition: inline";
  echo "&lt;HTML&gt;&lt;BODY&gt;&lt;PRE&gt;";
  cat /tmp/report_details.html;
  echo "&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;";
  ) | /usr/sbin/sendmail -t
  </code></pre>
  
  <p>I do not have mutt option, but I tried sendmail, mailx and mail service and none is able to help me meet my apparently simple need</p>
  
  <p>Unix OS: Solaris 10 8/07 s10s_u4wos_12b SPARC</p>
  
  <p>Note: Don't tag this as duplicate with existing answers, as they either have option to send attachment or html body or attachment with plain body.</p>