.Net Core version: 3.1 Server: Linux(Ubuntu 18.04 LTS)
Issue
Our use case is to send Email to customers using SMTP server. This SMTP server is configured with NTLM as authentication mechanism. When we make use of default "System.net.mail.SmtpClient" package in .NetCore, it fails to even create a successful connection. And hence the email sending fails on the Linux server with .NetCore build.
Code snippet
We tried the following code snippet to send mail:
SmtpClient client = new SmtpClient();
client.Port = smtp.Port;
client.UseDefaultCredentials = false;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Credentials = new NetworkCredential(smtp.Login, smtp.Password);
client.Host = smtp.Server;
client.EnableSsl = smtp.EnableSSL;
mail.Body = builder.ToString();
client.Send(mail);
Error
"GSSAPI operation failed with error - An unsupported mechanism was requested. NTLM authentication requires the GSSAPI plugin 'gss-ntlmssp'. So we installed the package 'gss-ntlmssp' on our linux server where the build is running but it still gives the error.
Latest Error
System.ComponentModel.Win32Exception (0x80090020): GSSAPI operation failed with error - An invalid name was supplied (Name is empty).
Can someone please suggest the correct fix for this issue or any work around for this problem?
User contributions licensed under CC BY-SA 3.0