title: Javamail Content-Type
body: <p>I'm trying to send an Email via javamail adding embedded Images and an Outlook Invation which should be displayed showing up the buttons to accept/decline .... To make the buttons show up, i have to set the Content-Type of the MimeMultipart to related. </p>
  
  <pre><code>MimeMultipart multipart = new MimeMultipart("related");
  </code></pre>
  
  <p>Once this is done, the embedded Pictures wont show up again.
  To Display the embedded images it should be alternative.</p>
  
  <p>I have send myself a Mail from Outlook containing an Image as well as a invation to a meeting.</p>
  
  <p>When I check the header there, it says:</p>
  
  <pre><code>Content-Type: multipart/related;
      boundary="_005_CCF531A072806F489D02A6DD2CF322A01D88EEA2de35s004hst42wp_";
      type="multipart/alternative"
  </code></pre>
  
  <p>I have already tried to set the Content-Type adding Parameters (type, charset ...) but it seems like their just getting ignored when sending the message. Here is the Method which I am calling to create the Message Part:</p>
  
  <pre><code>private Message generateMessage() throws Exception
  {
      Configuration conf = Configuration.getInstance();
      // Get system properties
      Properties props = System.getProperties();
  
      // Setup mail server
      props.put("mail.smtp.host", conf.getProperty(Configuration.MAIL_SERVER));
  
      // Get session
      Session session = Session.getDefaultInstance(props, null);
      // Create the message
      Message message = new MimeMessage(session);
  
      // Fill its headers
      message.setSubject(this.subject);
      message.setFrom(new InternetAddress(fromEmail));
      Address[] replyTo = new Address[]{new InternetAddress(replyEmail)};
      message.setReplyTo(replyTo);
  
      // Create a related multi-part to combine the parts
      MimeMultipart multipart = new MimeMultipart("related");
  
      // Create your new message part
      BodyPart messageBodyPart = new MimeBodyPart();
      multipart.addBodyPart(messageBodyPart);
  
      // ADD IMAGES
      multipart = attachImages(multipart);
  
      // ADD CALENDAR-FILE        
      multipart = attachCalendarFile(multipart);
  
      // Set Content-Type
      ContentType ct = new ContentType(message.getContentType());
      ct.setParameter("charset", "utf-8");
      ct.setParameter("type", "multipart/alternative");
  
      // Set Multipart-Content to Message including the Content-Type
      message.setContent(multipart, ct.toString());
  
      return message;
  }
  </code></pre>
  
  <p>The output of message.writeTo(System.out); is the following:</p>
  
  <pre><code>From: mail@sender.com
  Reply-To: noreply@recipient.com
  Message-ID: &lt;1150322817.1.1397725164700.JavaMail.User@MacBooks-mailserver.local&gt;
  Subject: test
  MIME-Version: 1.0
  Content-Type: multipart/related; 
  boundary="----=_Part_0_72769750.1397725164655"
  
  ------=_Part_0_72769750.1397725164655
  </code></pre>
  
  <p>Is there any chance to make it work with embedded images AND invations?</p>
  
  <p>Thanks in advance!</p>