How do we Remove Headers from a Message.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, July 15, 2004 03:45 AM

I am Trying to remove headers from my message by using the Method -- message.removeHeader(String headerName), but i get a Exception ---- javax.mail.IllegalWriteException: IMAPMessage is read-only. I am getting this exception even after i open the Folder in Read_Write mode. Here is the Source Code: Folder folder = store.getFolder("Test"); folder.open(Folder.READ_WRITE); Message message[] =folder.getMessages(); for (int i=0, n=message.length; i for (Enumeration e = message[i].getAllHeaders(); e.hasMoreElements(); ){ Header header =(Header)e.nextElement(); message[i].removeHeader(header.get   More>>

I am Trying to remove headers from my message by using the Method -- message.removeHeader(String headerName), but i get a Exception ---- javax.mail.IllegalWriteException: IMAPMessage is read-only.



I am getting this exception even after i open the Folder in Read_Write mode.


Here is the Source Code:



Folder folder = store.getFolder("Test");


folder.open(Folder.READ_WRITE);


Message message[] =folder.getMessages();


for (int i=0, n=message.length; i


for (Enumeration e = message[i].getAllHeaders(); e.hasMoreElements(); ){

Header header =(Header)e.nextElement();

message[i].removeHeader(header.getName());

}



Any Help will be greatly appreciated.
Thanks

   <<Less
About | Sitemap | Contact