Imap connection : 003 BAD Protocol Error: Invalid string supplied for password

Hi,

I try to connect to an email server by using the IMAP protocol.

With the following code, the Connect method throw the exception "003 BAD Protocol Error: Invalid string supplied for password"

ImapClient client = new ImapClient();
client.Host = this.emailServer;
client.Username = this.user;
client.Password = this.password;
client.Port = this.serverPort;
client.Connect(true);ImapClient client = new ImapClient();

The password contains letters, numbers and an *

Should I encode the password ?

Do you have any idea of what is wrong. I did the same this another component and it works.

Thank you for your help.

Regards

Hi VIVIET,

Thank you for considering Aspose.Email.

I have tested the scenario you have mentioned with our online exchange server 2010. The password contains a “*” at the end. However, I am afraid to share that I was not able to reproduce this issue at my end with this email account.

In order to investigate this issue further, I would request you to please create a test account for us on the mentioned server and pass on the credentials to us so that we can use it at our end to reproduce this issue and assist you further. Please make sure to make this thread private in case the account contains confidential data. The following code was used at my end for testing:

Sample Code:

ImapClient client = new
ImapClient(“exchange.domain.com”,
"username ", “password”);

client.SecurityMode = ImapSslSecurityMode.Explicit;

client.EnableSsl = true;

client.Connect();

client.Login();

ImapFolderInfoCollection folders = client.ListFolders();

Console.WriteLine(folders.Count);

Hi,

I use an internal email server. Unfortunately, it's not possible for me to give you access to an email account. The email server is a 2003 Exchange server. I think that the server use a Basic or NTLM authentication.

I will try to investigate this problem by myself, but if you have any sugestion you're welcome.

Thank you for your help.

Best Regards

Régis

Hi Regis,


In case of NTLM, could you please use the ImapClient.UseDefaultCredentials = true at your end? The complete sample code is as follow, assuming that “server” refers to the settings of your host server. Please let us know your feedback then.

Sample Code:


using (ImapClient imapClient = new ImapClient(server.ImapUrl, server.ImapPort))

{

imapClient.EnableSsl = server.ImapEnableSsl;

imapClient.SecurityMode = server.ImapSecurityMode;

imapClient.UseDefaultCredentials = true;


imapClient.Connect(true);

}