Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET IMAP

 AfterLogic Forum : MailBee.NET IMAP
Subject Topic: IMAP ’deleted’ status? Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
mcassels
Newbie
Newbie
Avatar

Joined: 19 June 2007
Location: United Kingdom
Online Status: Offline
Posts: 4
Posted: 19 June 2007 at 3:12am | IP Logged Quote mcassels

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 View mcassels's Profile Search for other posts by mcassels
 
mcassels
Newbie
Newbie
Avatar

Joined: 19 June 2007
Location: United Kingdom
Online Status: Offline
Posts: 4
Posted: 19 June 2007 at 6:28am | IP Logged Quote mcassels

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 View mcassels's Profile Search for other posts by mcassels
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 19 June 2007 at 7:55am | IP Logged Quote Alex

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 View Alex's Profile Search for other posts by Alex
 
mcassels
Newbie
Newbie
Avatar

Joined: 19 June 2007
Location: United Kingdom
Online Status: Offline
Posts: 4
Posted: 20 June 2007 at 12:35am | IP Logged Quote mcassels

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 View mcassels's Profile Search for other posts by mcassels
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 20 June 2007 at 3:22am | IP Logged Quote Andrew

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 View Andrew's Profile Search for other posts by Andrew
 
mcassels
Newbie
Newbie
Avatar

Joined: 19 June 2007
Location: United Kingdom
Online Status: Offline
Posts: 4
Posted: 25 June 2007 at 2:35am | IP Logged Quote mcassels

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 View mcassels's Profile Search for other posts by mcassels
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide