This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to get the entire MIME message from a BodyPart?  RSS feed

 
Lionel Pasquier
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
I am new to javaMail and quite lost with its way of working.
I have a tool that creates SMIME stuff that needs to be put into MIME envelopes. In the same time I have to manage parsing of simple MIME messages.
My current problem is the following:
I have a BodyPart and I am testing if it is SMIME or not (with checks on the ContentType). If it is, then I want to retrieve the entire MIME message as a String or a byte[]. I mean, the whole text stuff with the headers and the -possibly- encoded64 content, or if you prefer the inputStream with which the BodyPart was created.
But I haven't found anything in BodyPart that returns such a thing (everything is about the content). There might be writeTo() but it needs an output stream that, if piped in a pipedinputstream, results in a dead lock...
Help please!!
Lionel
 
Lionel Pasquier
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry about that, but it seems that writeTo(ByteArrayOutputStream) is doing the trick.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!