title: Conversion from MimeMessage to byte array
body: <p>I need to convert MimeMessage into byte array, but while converting some characters are not coded correctly. Code lookis like this:</p>
  
  <pre><code>// message is MimeMessage
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  message.writeTo(baos);
  byte[] bytes = baos.toByteArray(); 
  </code></pre>
  
  <p>This conversion doesn't work correctly, as output I'm receving wrong formatted email body:</p>
  
  <pre><code>&lt;html xmlns=3D"http://www.w3.org/1999/xhtml" xml:lang=3D"en" lang=3D"en"
     &gt;
  &lt;body style=3D"background-color: #ffffff;"  &gt;
  </code></pre>
  
  <p>...</p>
  
  <p>3D should not be present in this (xmlns=<strong>3D</strong>"http:). I could remove it but this is not a safe solution, I might accidentally remove some content from the email body.</p>
  
  <p>Any tip may help.</p>