0 votes

When I run the code I can connect OK but when I attempt to login I get the following exception

log.LogMessageFormat(LogMessagePriority.Debug, "Connecting to IMAP server '{0}'", MySettings.IMAPHost);
imap.Connect(MySettings.IMAPHost);
log.LogMessageFormat(LogMessagePriority.Debug, "Logging in to IMAP server as '{0}'", MySettings.IMAPLogin);
imap.Login(MySettings.IMAPLogin, MySettings.IMAPPsw); FAILS HERE

Exception message is "{Limilabs.Client.IMAP.ImapResponseException: Protocol Error: "Expected SPACE not found"."

I think this is a response from the server but I don’t know what it is trying to tell me. Can you advise?

by

1 Answer

0 votes

When authenticating to an Exchange server using plain-text user/password authentication, if the user value that is specified is not correctly formatted you will see an error from the server "Expected SPACE Not Found".

A properly formatted user must have the backslash escaped (as every .NET string):

string user = "Domain\\User";

Forward slash must not be escaped of course:

string user = "Domain/User";
by (301k points)
...