title: Inline images in email using JavaMail
body: <p>I want to send an email with an inline image using javamail.</p>
  
  <p>I'm doing something like this.</p>
  
  <pre><code>MimeMultipart content = new MimeMultipart("related");
  
  BodyPart bodyPart = new MimeBodyPart();
  bodyPart.setContent(message, "text/html; charset=ISO-8859-1");
  content.addBodyPart(bodyPart);
  
  bodyPart = new MimeBodyPart();
  DataSource ds = new ByteArrayDataSource(image, "image/jpeg");
  bodyPart.setDataHandler(new DataHandler(ds));
  bodyPart.setHeader("Content-Type", "image/jpeg; name=image.jpg");
  bodyPart.setHeader("Content-ID", "&lt;image&gt;");
  bodyPart.setHeader("Content-Disposition", "inline");
  content.addBodyPart(bodyPart);
  
  msg.setContent(content);
  </code></pre>
  
  <p>I've also tried</p>
  
  <pre><code>    bodyPart.setHeader("inline; filename=image.jpg");
  </code></pre>
  
  <p>and</p>
  
  <pre><code>    bodyPart.setDisposition("inline");
  </code></pre>
  
  <p>but no matter what, the image is being sent as an attachment and the Content-Dispostion is turning into "attachment".</p>
  
  <p>How do I send an image inline in the email using javamail?</p>