Generating a string representation of a email message in Java

Thursday, July 10, 2014

I am trying to obtain a string of the content of an email message. I.E. the equivalent of saving a message from Thunderbird and viewing it inside Notepad. So, in Java I tried playing with the javax.mail library. But, that was ultimately a failure as I can't find a way to take the message and output it as a string. What other options do I have? I suppose I could concatenate a bunch of strings together to resemble to the correct format but I rather have something correct generated for me (if possible). In .NET you could use the mail class and just do a .toString().