This is my simplified code:
using ImapX;
private ImapClient Client { get; set; }
private void SetupListener(string mail, string password)
{
Client = new ImapClient();
Client.Connect("imap.gmx.net", 993, true);
// Client.IsConnected == true
Client.Login(mail, password);
// Client.IsAuthenticated == true
// Test 1
Client.Folders.Inbox.OnNewMessagesArrived += MessageArrived;
// Test 2
Client.OnNewMessagesArrived += MessageArrived;
}
private void MessageArrived(object sender, IdleEventArgs e)
{
MessageBox.Show("This never pops up!");
}
This already shows up my problem. MessageArrived
is never getting called.
I tried this out with 2 different providers. Same problem for both (t-online.de and gmx.net).
Any idea whats going on in here?
The documentation isn't showing up anything else than this.
Please, try to call Client.Folders.Inbox.StartIdling();
after subscribing.
This will help you to receive messages in real time.
I refer to the documentation here
ImapX supports idle, so you can receive new messages just-in-time. Once new messages arrive in the current folder, they will be downloaded automatically and an event will be fired.