I cannot connect to any mail accounts to retrieve emails using the AE NET Mail IMAP library. I've used it a while ago and it's good, but I've come back to it and in a new project it's not working for any email account. I have the following code:
using (var client = new AE.Net.Mail.ImapClient(
"mail.live.com",
"myemail@outlook.com",
"password_SV",
ImapClient.AuthMethods.Login, 993, false
))
{
client.SelectMailbox("INBOX");
AE.Net.Mail.MailMessage[] mailmessage = client.GetMessages(0, 5, false, true);
foreach (AE.Net.Mail.MailMessage msg in mailmessage)
{
collection.Add(new Message()
{
Id = msg.MessageID,
Sender = msg.Sender,
Subject = msg.Subject,
Content = msg.Body
});
}
client.Logout();
client.Disconnect();
list.ItemsSource = collection;
But for some reason it just keeps loading (the spinning loading cursor) and the whole UI blocks up. After waiting for 10 minutes - absolutely nothing happens. It just keeps loading, and loading and loading. What am I doing wrong? How can we retrieve mail? I have also tried other accounts, like gmail, and my own one, but the same issues. How can we retrieve mail from outlook.com?