I would like to make an email listener that listens for an imap mailbox. My main idea is to simply track the server using the imap client, how to create such a loop in f # and how I can turn the program into a service that can be started and stopped. Also, is there a better way to listen to the imap server than polling it every few seconds?
EDIT
I found this question that answers my questions about creating a service: Writing a Windows Polling Service . However, the question still remains if this is the right way to listen to the IMAP mailbox. Will there be any probable problems?
EDIT 2
I looked at S22.Imap, which uses an event handler in C #, but I'm not sure how to implement this in F #, basically this line:
// We want to be informed when new messages arrive Client.NewMessage += new EventHandler<IdleMessageEventArgs>(OnNewMessage);
I assume that the program is so supported, does it sit on this line, waiting for events?
The code author also posted this under this, which I don't quite understand:
Can someone explain to me how I can implement this in F #? A complete example is available here .
Edit 3
Not sure why this particular question was closed, perhaps the last sentence of Edit 2 was not read. So my question is:
Can someone explain to me how I can handle event handling in F #? I can not find anything on Google that is not for graphical applications. How can I give an example of the C # code above into something in F #?
Any explanation of downvotes would also be appreciated, my original question was partially answered by some people, and I found some answers for myself, but he did not get a complete answer, the question just turned into something a little different.