Skip to content

Kerberos/Negotiate does not work with SmtpClient #105938

@avin3sh

Description

@avin3sh

Description

Kerberos with SmtpClient does not work in .NET. This isn't an issue in .NET Framework.

Reproduction Steps

Initialize SmtpClient with UseDefaultCredentials = true and try sending the mail.

Expected behavior

Negotiate should work

Actual behavior

Smtp server returns Temporary authentication failure: generic failure and on the .NET side this error appears as Command not implemented. The server response was: 5.5.2 Error: command not recognized.

Regression?

No difference when the behavior is compared with other versions

Known Workarounds

No response

Configuration

No response

Other information

If you look at the packet capture, it appears that CRLF response is being handled twice after negotiate exchange completes. This seems to be a bug because on .NET Framework there is only single CRLF response after token exchange.

image

A fix for this issue is important because MailKit, which is currently recommended in the docs, does not support Kerberos(jstedfast/MailKit#1249). Not having a functional Kerberos support in the BCL SmtpClient blocks any efforts of migrating from .NET framework.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Netin-prThere is an active PR which will close this issue when it is merged

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions