title: How to attach a file to an HTML email using Apache Commons Email
body: <p>I'm using <a href="http://commons.apache.org/email/userguide.html" rel="noreferrer">Apache Commons Email 1.1</a> and I can't figure out how to attach a file to an HtmlEmail.  If I run the code below, I get an email with an attachment, but the HTML message comes across as an attachment also.</p>
  
  <p>If I don't call email.attach() the HTML message come through as you would expect, but I need both the HTML message to come through and the attachment.  What am I missing?</p>
  
  <pre><code>  HtmlEmail email = new HtmlEmail();
    email.setHostName("localhost");
    email.addTo("test@mail.com", "Test");
    email.setFrom("testapp@mail.com", "Test App");
    email.setSubject("Test message");
    email.setHtmlMsg("&lt;div style='font-size: 20px; color: green;'&gt;This is html email&lt;/div&gt;");
  
    EmailAttachment attachment = new EmailAttachment();
    attachment.setPath(pdfPath);
    attachment.setDisposition(EmailAttachment.ATTACHMENT);
    email.attach(attachment);
  
    email.send();
  </code></pre>