I tried until now to create an object of type MimeMessage
using JavaMail api, and after that to obtain its raw representation, but with no success. The only thi
What you are looking for is MimeMessag#writeTo which outputs the message as an RFC 822 format stream.
An example of using writeTo
to convert a MimeMessage
to a String.
MimeMessage mimeMessage;
// mimeMessage get assigned
ByteArrayOutputStream output = new ByteArrayOutputStream();
mimeMessage.writeTo(output);
String rawEmail = output.toString();