Author |
|
mcassels Newbie
Joined: 19 June 2007 Location: United Kingdom
Online Status: Offline Posts: 4
|
Posted: 19 June 2007 at 3:12am | IP Logged
|
|
|
Hi, how do I tell if a message is deleted, waiting to be purged?
I'm running a process that goes through a mailbox to log certain emails to a database and then deletes them, but if the process breaks for any reason, the expunge might not happen and the message will be still be picked up again despite being flagged for deletion on the next run so I'd like to check the email's delete status as I go along.
Wouldn't matter too much but there's a lot of emails come in, last run was about 136000 messages (several months worth, and the expunge took so long it timed out and raised an exception! While I'm at it, is there a way to increase the timeout?
Many thanks, hope you can help
Cheers
|
Back to Top |
|
|
mcassels Newbie
Joined: 19 June 2007 Location: United Kingdom
Online Status: Offline Posts: 4
|
Posted: 19 June 2007 at 6:28am | IP Logged
|
|
|
Hi, I know I could call the expunge method after each delete, but given the size of the mailbox, it slows down processing a lot...
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 19 June 2007 at 7:55am | IP Logged
|
|
|
Quote:
While I'm at it, is there a way to increase the timeout?
|
|
|
You should increase Imap.Timeout value (20000 milliseconds is default).
Quote:
Hi, I know I could call the expunge method after each delete, but given the size of the mailbox, it slows down processing a lot... |
|
|
Maybe, you may call Expunge twice? First time, when you select the folder (prior to processing any messages), and second time after you finished processing messages.
Code:
imap.SelectFolder(folder);
imap.Expunge();
// Main processing
imap.Close();
|
|
|
Note using Close instead of Expunge in the end. On some servers, Close may be faster (well, hell faster) than Expunge. This is because the server knows the client left this folder and does not want to wait until expunge completes (and thus expunge may run in the background).
Regards,
Alex
|
Back to Top |
|
|
mcassels Newbie
Joined: 19 June 2007 Location: United Kingdom
Online Status: Offline Posts: 4
|
Posted: 20 June 2007 at 12:35am | IP Logged
|
|
|
Hi thanks for that, can I tell if a message has a status of 'deleted' though? I'd like to make the system aware of deleted messages so that I can ignore them if they are there!
Thanks
Martin
|
Back to Top |
|
|
Andrew AfterLogic Support
Joined: 28 April 2006 Location: United States
Online Status: Offline Posts: 1189
|
Posted: 20 June 2007 at 3:22am | IP Logged
|
|
|
When your application downloaded envelopes, it may check "Deleted" flag of each envelope to know if the message is marked for removal.
Best regards,
Andrew
|
Back to Top |
|
|
mcassels Newbie
Joined: 19 June 2007 Location: United Kingdom
Online Status: Offline Posts: 4
|
Posted: 25 June 2007 at 2:35am | IP Logged
|
|
|
That's great, worked a treat!
I just downloaded the envelope collection for a single message UID, and checked for 'Deleted' in the flags.ToString of the envelope at index zero in the collection...
Thanks Again
Martin
|
Back to Top |
|
|