title: Convert an email into its raw format using java
body: <p>I tried until now to create an object of type <code>MimeMessage</code> using JavaMail api, and after that to obtain its raw representation, but with no success. The only thing that I could obtain is a raw representation of the <strong>content</strong> of the email, but the header, subject, or recipients were not included. I am interested in any suggestions, any java libraries, that could help me in creating an email object, and after that obtain its raw representation. The raw representation should look something like this: </p>
  
  <pre><code>received: from imta14.emeryville.ca.mail.myisp.net ([nn.nn.30.46])
  by alnrmxc19.isp.net (alnrmxc19) with ESMTP
  id &lt;20080930215116a19007q9u6e&gt;; Tue, 30 Sep 2008 21:51:16 +0000
  X-Originating-IP: [nn.nn.30.46]
  Received: from libertatea.go ([nn.nn.161.160])
  by IMTA14.mail.isp.net with isp
  id M9qy1a00V3TwUto0E9rELB; Tue, 30 Sep 2008 21:51:15 +0000
  X-Authority-Analysis: v=1.0 c=1 a=DZlucjOqAY8A:10 a=mnGO974OAAAA:8
  a=9MJFf195B83LjESASTQA:9 a=Lm7NQ261g8eJHgoaELoA:7
  a=7Narey355jFQWZRww2lj1r9-lCkA:4 a=8COHQAuY8ZYA:10 a=zEVpGHA-kecA:10
  a=37WNUvjkh6kA:10
  Received: by libertatea.go id hm1nfa0di0sn for &lt;xxx@myisp.net&gt;; Sun,30 Sep 2018 09:36:35
  +0300 (envelope-from &lt;Hometown.Quotes_ary@mousemegadot.com&gt;)
  Message-ID: &lt;79864795@mousemegadot.com&gt;
  Date: Sun, 30 Sep 2018 09:36:35 +0300
  From: "Hometown Quotes" &lt;Hometown.Quotes_ary@mousemegadot.com&gt;
  To: dummy@myisp.net
  Subject: Find Affordable Auto Insurance Today
  MIME-Version: 1.0
  X-UID: 79864795.modhnrfo.jhhnk.1
  Content-Type: multipart/alternative; boundary="0-1411506895-1200484069=:66653"
  Content-Transfer-Encoding: 8bit
  X-PMFLAGS: 570966272 9 1 PE71PYHD.CNM 
  X-UC-Weight: [# ] 51
  X-CC-Diagnostic: Test 'LazyHTML Tolerant' (51)
  
  --0-1411506895-1200484069=:66653
  Content-Type: text/plain; charset=iso-8859-1
  Content-Transfer-Encoding: 8bit
  
  --0-1411506895-1200484069=:66653
  Content-transfer-encoding: 8bit
  Content-Type: text/html; charset=iso-8859-1; DelSp="Yes"; format="flowed"
  </code></pre>