Reputation: 301
Unable to connect Outlook 365 account for reading mails using Pop3Client C# library, receiving error The server did not respond with a + response. The response was: -ERR Logon failure: unknown user name or bad password.Server did not accept user credentials. I'm using below code for connecting Outlook accout.
MailBox mailBox = new MailBox(emailId, password);
Pop3Client pop3Client;
foreach (Credential credential in mailBox.mailBoxList)
{
pop3Client = new Pop3Client();
Console.WriteLine("Connecting to POP.......");
pop3Client.Connect("outlook.office365.com", 995, true);
Console.WriteLine("POP Connected.......");
Console.WriteLine("Authenticating Email......." + credential.EmailId);
//pop3Client.Authenticate(credential.EmailId, credential.Password); //I have tried without AuthenticationMethod type
pop3Client.Authenticate(credential.EmailId, credential.Password, AuthenticationMethod.UsernameAndPassword);
Console.WriteLine("Authentication Done.......");
if (pop3Client.Connected == true)
{
//TO DO Code
}
}
Upvotes: 1
Views: 2384
Reputation: 301
Follow the below steps to solve this problem (outlook 365 Account).
Upvotes: 1