title: How to retrieve the body from a MimeMessage email in Java
body: <p>I am trying to get the body content of a MIMEMessage. The email is essentially a .EML file saved as a text file. The code below then converts it into a MIMEMessage</p>
  
  <pre><code>        InputStream mailFileInputStream = new FileInputStream(emailFile);
          Properties props = new Properties();
          Session session = Session.getDefaultInstance(props, null);
          MimeMessage message = new MimeMessage(session, mailFileInputStream);
  </code></pre>
  
  <p>However when I try to use a MimeMessageParser to parse and get the separate parts, I can get everything but the html content, with the code below:</p>
  
  <pre><code>        MimeMessageParser parser = new MimeMessageParser(message);
          String from = parser.getFrom();
          List&lt;Address&gt; to = parser.getTo();
          List&lt;Address&gt; cc = parser.getCc();
          List&lt;Address&gt; bcc = parser.getBcc();
          String subject = parser.getSubject();
          String htmlContent = parser.getHtmlContent(); // Doesnt work
  </code></pre>
  
  <p>Am I missing out a step in the parsing or is there an easier way to retrieve the body?</p>