jstedfast / MailKit

A cross-platform .NET library for IMAP, POP3, and SMTP.
http://www.mimekit.net
MIT License
6.04k stars 809 forks source link

in the sample project of imapidle, is it possible to add a sample method for how to cancel the "IDLE" mode. thanks! #1742

Closed kenizhou closed 3 months ago

kenizhou commented 3 months ago

Thanks for your great works in advance!

I am doing a PoC on a mail client. and seeing how to support "IDLE" mode to show the coming emails notification ,flags change,...

I tested "ImapIdle", it is running perfect as the expected. but don't know how to exit the "IDLE" mode to serve a user request. Is there any the best practice for the following scenario: The mail client is running in "IDLE" mode, then user want to Fetch and read an email. how to exit the "IDLE" mode and execute the "Fetch" immediately?

Thanks!

jstedfast commented 3 months ago

You just need to cancel the doneToken. It can literally be done anywhere in your code.

kenizhou commented 3 months ago

thanks