MailKit icon indicating copy to clipboard operation
MailKit copied to clipboard

No compatible authentication mechanisms found

Open raigol opened this issue 9 years ago • 2 comments

I keep getting "System.NotSupportedException: No compatible authentication mechanisms found" when trying to send e-mail out.

I have tried adding one by one following Authenication mechanisms, but no difference client.AuthenticationMechanisms.Add("AuthLogin"); client.AuthenticationMechanisms.Add("AuthPlain"); client.AuthenticationMechanisms.Add("AuthNTLM"); client.AuthenticationMechanisms.Add("AuthAuto");

for the sending I am using same code as in example, just replaced server, user, pwd to my own

using (var client = new SmtpClient ()) { // For demo-purposes, accept all SSL certificates (in case the server supports STARTTLS) client.ServerCertificateValidationCallback = (s,c,h,e) => true;

			client.Connect ("smtp.friends.com", 587, false);

			// Note: since we don't have an OAuth2 token, disable
			// the XOAUTH2 authentication mechanism.
			client.AuthenticationMechanisms.Remove ("XOAUTH2");

			// Note: only needed if the SMTP server requires authentication
			client.Authenticate ("joey", "password");

			client.Send (message);
			client.Disconnect (true);
		}

raigol avatar Jun 26 '17 14:06 raigol

And what authentication mechanisms are contained within the AuthenticationMechanisms hash set after you call Connect()?

None?

If none, then the server doesn't support authentication.

jstedfast avatar Jun 26 '17 16:06 jstedfast

Also: "AuthLogin", "AuthPlain", etc. do not match any of the names that need to be used, so of course they don't work :)

jstedfast avatar Jun 26 '17 16:06 jstedfast