How do I convert a MimePart into a MimeMultipart containing the original MimePart and a new part?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Robert_Dickinson
Posted On:   Sunday, November 18, 2001 03:32 AM

I am trying to convert an arbitrary mime part somewhere in a mime hierarchy into a multipart containing the original part and a new part. This is so that I can receive a message, decompose (decompress, decode documents, etc) it's parts, review the new content, then remove the new content again before sending the message back out. Here is something like what I tried: private void expandPart(MimePart mp) { MimeMultipart multipart = new MimeMultipart("X-Expanded"); MimeBodyPart exPart = getExpandedPart(mp); multipart.addBodyPart((BodyPart)mp); multipart.addBodyPart((BodyPart)exPart); mp.setContent(multipart); }    More>>

I am trying to convert an arbitrary mime part somewhere in a mime hierarchy into a multipart containing the original part and a new part.

This is so that I can receive a message, decompose (decompress, decode documents, etc) it's parts, review the new content, then remove the new content again before sending the message back out.


Here is something like what I tried:



			
private void expandPart(MimePart mp)
{
MimeMultipart multipart = new MimeMultipart("X-Expanded");

MimeBodyPart exPart = getExpandedPart(mp);

multipart.addBodyPart((BodyPart)mp);
multipart.addBodyPart((BodyPart)exPart);

mp.setContent(multipart);
}


I expected this to change my original part into a "multipart/X-expanded" part with two child parts: the original part and the expanded version. What I get is a complete mess (based on inspecting the mp at the end of the function).

   <<Less
About | Sitemap | Contact