–1 vote

Getting exception "AUTHENTICATE failed." while connecting imap can anyone pls help

using (Imap imap = new Imap())
{
    imap.ConnectSSL(UserMailServerSetting.MailServer);
    imap.UseBestLogin(Email, AppPassword);

}

by
edited

1 Answer

0 votes

There are several reasons why your server is refusing to authenticate you.

Most common are:

  • Invalid username or password.
  • IMAP protocol being turned off for this account.
  • OAuth 2.0 is required instead of username/password authentication scheme.
  • OAuth 2.0 is required instead of username/app password authentication scheme.

Depending on the email provider your options and solutions differ greatly.

If you are using Office365 (error message suggests that) go here:
https://www.limilabs.com/blog/office-365-basic-auth-is-disabled

For other providers you may want to browse samples here:
https://www.limilabs.com/mail/samples

by (301k points)
...