Author |
|
wzh Newbie
Joined: 07 January 2019
Online Status: Offline Posts: 7
|
Posted: 23 February 2020 at 8:00pm | IP Logged
|
|
|
How do I synchronize all folders in a single mailbox,idle only select one folder.
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 24 February 2020 at 1:16am | IP Logged
|
|
|
You can make multiple connections to the same mail account, each connection to a separate folder.
Regards,
Alex
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 24 February 2020 at 1:19am | IP Logged
|
|
|
Also, some mail servers (e.g. Gmail) support AllMail folder which you can monitor.
Regards,
Alex
|
Back to Top |
|
|
wzh Newbie
Joined: 07 January 2019
Online Status: Offline Posts: 7
|
Posted: 24 February 2020 at 4:51pm | IP Logged
|
|
|
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 |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 25 February 2020 at 1:58am | IP Logged
|
|
|
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 |
|
|