0
votes

i'm current deploy one application into docker container, this app have function sending mail (base on c# netcore 2.2) but i can not sending mail (while mean i can sending mail from localhost) the message of exception in docker

System.ComponentModel.Win32Exception: GSSAPI operation failed with error - Unspecified GSS failure. Minor code may provide more information (Cannot find KDC for realm "xxx.yyyy"). at System.Net.Security.NegotiateStreamPal.AcquireCredentialsHandle(String package, Boolean isServer, NetworkCredential credential) at System.Net.NTAuthentication.Initialize(Boolean isServer, String package, NetworkCredential credential, String spn, ContextFlagsPal requestedContextFlags, ChannelBinding channelBinding) at System.Net.Mail.SmtpNegotiateAuthenticationModule.Authenticate(String challenge, NetworkCredential credential, Object sessionCookie, String spn, ChannelBinding channelBindingToken) at System.Net.Mail.SmtpConnection.SetContextAndTryAuthenticate(ISmtpAuthenticationModule module, NetworkCredential credential, ContextAwareResult context)
at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send(MailMessage message)

i have try some help from google but can not, so please help me thanks

1

1 Answers

0
votes

It seems there is an issue in dotnet on linux, when you send mails with the GSSAPI authentication type: https://github.com/dotnet/runtime/issues/2174, https://github.com/dotnet/runtime/issues/25885, https://github.com/dotnet/runtime/issues/27285

Try installing "gss-ntlmssp" in the container if you need to use GSSAPI.

Or, if your server accepts other authentication types, use another one, like NTLM:

var cred = new NetworkCredential(user, password, domain);
var cache = new CredentialCache();
cache.Add(host, 25, "NTLM", cred);
client.Credentials = cache;