We are writing a Java class that reads emails from a mail box and saves the attachments to email on the physical drive. Along with saving the attachments, we need to save the email to the physical drive too but without the attachments. We are to use POP3 for retrieving the emails. We tried calling the removeBodyPart() method of the Multipart class. Although the method returns a true value when passed the index of the part to be removed or even if reference of the part is passed, when we save the Message object, it still has the attachments in it.
We tried calling the setContent() method of the Message class and passed it the Multipart object on which the removeBodyPart() method has been called. But that gives "javax.mail.IllegalWriteException: POP3 messages are read-only" message. Can anyone let me know what can be done for this?