I had an issue with the ImapClient connection because of special characters in my password. After I changed my password everything worked properly.
I investigated this a bit further, and it turns out that there is a PLAIN authentication option that I should use. I found the ImapAuthentication class having the required feature. (https://reference.aspose.com/email/net/aspose.email.clients.imap/imapauthentication/properties/plaintextauthentication
)
But… this class is obsolete… and I cannot find any examples on how to use it.
How do I solve this in the current version?
using System;
using Aspose.Email.Clients;
using Aspose.Email.Clients.Base;
using Aspose.Email.Clients.Imap;
namespace JustTesting
{
class Program
{
static void Main(string[] args)
{
var host = "mail.papasmurf.nl";
var port = 143;
var user = "test@papasmurf.nl";
var pass = "pP{hKrMiJ%5r";
//pass = "xxxxxxxxxx"; // I do not disclose my real password
ImapClient client = new ImapClient();
client.Host = host;
client.Username = user;
client.Password = pass;
client.Port = port;
client.UseDefaultCredentials = true;
client.SecurityOptions = SecurityOptions.None;
Console.WriteLine($"ConnectionState = {client.ConnectionState}");
var f = client.ListFolders();
foreach (var imapFolderInfo in f)
{
Console.WriteLine(imapFolderInfo.Name);
}
Console.WriteLine("Hello World!");
}
}
}