Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET IMAP

 AfterLogic Forum : MailBee.NET IMAP
Subject Topic: How do sync all folders in single maibox Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
wzh
Newbie
Newbie


Joined: 07 January 2019
Online Status: Offline
Posts: 7
Posted: 23 February 2020 at 8:00pm | IP Logged Quote wzh

How do I synchronize all folders in a single mailbox,idle only select one folder.
Back to Top View wzh's Profile Search for other posts by wzh
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 24 February 2020 at 1:16am | IP Logged Quote Alex

You can make multiple connections to the same mail account, each connection to a separate folder.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 24 February 2020 at 1:19am | IP Logged Quote Alex

Also, some mail servers (e.g. Gmail) support AllMail folder which you can monitor.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
wzh
Newbie
Newbie


Joined: 07 January 2019
Online Status: Offline
Posts: 7
Posted: 24 February 2020 at 4:51pm | IP Logged Quote wzh

Write it as follows: run exception,Can you provide sample code,thanks.

var imp = new Imap();
imp.Login(textBoxLogin.Text, textBoxPassword.Text);
               LogMessage("Logged into the server");

               // Select Inbox folder
               imp.SelectFolder("Inbox");

               // Add message status event handler which will "listen to server" while idling
               imp.MessageStatus += new ImapMessageStatusEventHandler(imp_MessageStatus);

               // Add idling event handler which is used for timer
               imp.Idling += new ImapIdlingEventHandler(imp_Idling);

               // Start idle timer
               TimerStart();

               // Start idling
               imp.BeginIdle(new AsyncCallback(IdleCallback), null);
               LogMessage("Started idling inbox");

               // Select 已发送 folder
               imp.SelectFolder("已发送");

               // Add message status event handler which will "listen to server" while idling
               imp.MessageStatus += new ImapMessageStatusEventHandler(imp_MessageStatus);

               // Add idling event handler which is used for timer
               imp.Idling += new ImapIdlingEventHandler(imp_Idling);

               // Start idle timer
               TimerStart();

               // Start idling
               imp.BeginIdle(new AsyncCallback(IdleCallbackOutbox), null);
               LogMessage("Started idling outbox");
Back to Top View wzh's Profile Search for other posts by wzh
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 25 February 2020 at 1:58am | IP Logged Quote Alex

I recommend .net 4.5 approach with async/await methods.

https://afterlogic.com/files/IdleAsyncSample.zip

We don't have a sample with monitoring multiple folders but the idea is to create a separate thread, separate connection (including separate Imap object) for each folder.

Also, with async/await synchronization primitives, you can use Task.WaitAny pattern instead of creating multiple threads to achieve better performance in case if you have lots of mail accounts to monitor.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 

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