Enrico,

 

I have quite a few applications that does the same thing. To assist I need to see more. I also use a for loop and must admit that I seldom get messages bigger than 5 MB.

 

To delete the message I use msgs[i].setFlag(Flags.Flag.DELETED, true); where msgs is  Message[] msgs.

 

Regards,

 

Gerhard Munro

 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Enrico Goosen
Sent: 01 February 2006 01:11 PM
To: [email protected]
Subject: [CTJUG Forum] JavaMail bug

 

Hi All,

 

Wonder if anyone could help me with this problem.

I have a mail reader thread that checks for emails every minute.

 

// Retrieve the messages

Message[] messages = folder.getMessages();

// Loop over all of the messages

for (int messageNumber = 0; messageNumber < messages.length; messageNumber++) {

//Process message…save attachments to directory

message.setFlag(Flags.Flag.DELETED, true);

}

// Close connection, "expunging" the deleted messages

folder.close(true);

store.close();

 

Quite often we receive a very large email (+/- 10 MB), and by the time it gets to the next message in this for loop, the folder/store has already closed.

I’ve added code to check if the store.isConnected before attempting to read the next message, but this doesn’t fix the problem of the message not getting deleted.

 

Because the folder/store has closed prematurely the message doesn’t get deleted.

 

Is there someway of preventing the folder/store from closing prematurely?

Otherwise, how do I make sure that a message gets deleted?

 

Thanks,

 

Enrico Goosen

Software Developer

SAICOM TECHNOLOGY

TEL:       +2721 555 0726

FAX:     +2721 555 0821

CEL:     +2783 305 5676

EMAIL: [EMAIL PROTECTED]

 

Reply via email to