deleting only attachments
1 posts in topic
Flat View  Flat View

Posted By:   gurpreet_ahluwalia
Posted On:   Thursday, October 31, 2002 01:15 AM

can anyone tell me how to

delete only attachments...

will this work



Re: deleting only attachments

Posted By:   Pasha_Paterson  
Posted On:   Thursday, October 31, 2002 12:53 PM

Well, I can tell you the way it should work...

// Assume some implementation of Multipart named msg.

for( int i = 1 ; i < msg.getCount() ; i++ )
msg.removeBodyPart(1) ;

// The above line uses 1 instead of i because the body part
// indices are updated by the removeBodyPart() method each
// time it is invoked.

I can also tell you that I haven't had too much success with getting the MimeMultipart object to recognize body part separators. If you have similar problems, you may have to parse through the message yourself, by acquiring the boundary string and discarding everything after its second occurrence in the message body.

About | Sitemap | Contact