Skip to content

Keycloak sends UTF-8 email when the SMTP server does not advertise SMTPUTF8 #55267

Description

@ahus1

Before reporting an issue

  • I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

Area

core

Bug Description

When Allow UTF-8 is enabled in a realm's email settings, Keycloak sends an email with an internationalized address without checking whether the connected SMTP server advertised the SMTPUTF8 extension. RFC 6531 section 3.2 requires an SMTPUTF8-aware client to avoid transmitting such an address when the server does not offer the extension.

Version

26.8.2

Regression

  • The issue is a regression

Expected behavior

An email containing an internationalized sender, recipient, reply-to, or envelope sender address fails before the SMTP envelope is transmitted if the server does not advertise SMTPUTF8. A message whose addresses are all ASCII can still be sent without the extension.

When Test connection is used with Allow UTF-8 enabled, it reports the missing capability even if the particular test email uses only ASCII addresses, so the action validates the configured mode.

Actual behavior

Keycloak proceeds to send an internationalized email without checking the server's advertised SMTP capabilities. A permissive server may accept the message even though it did not advertise SMTPUTF8. Test connection can also report success for such a server.

How to Reproduce?

  1. Start a permissive test SMTP server that responds to EHLO without advertising SMTPUTF8, accepts subsequent SMTP commands, and records them.
  2. Configure a realm to use that server, enable Allow UTF-8, and set the sender address to autoñ@example.org.
  3. Run Test connection in the realm email settings.
  4. Observe that Keycloak issues MAIL FROM despite the missing SMTPUTF8 capability.
  5. Repeat with the ASCII sender address auto@example.org. The test action reports success even though the server cannot support internationalized addresses under the configured mode.

Anything else?

RFC 6531 section 3.2: https://www.rfc-editor.org/rfc/rfc6531.html#section-3.2

AI assistance was used to draft this report. I checked the affected code in 26.8.2 and prepared local regression tests with a server that omits SMTPUTF8 from its EHLO response.

Activity

  1. added
    area/coreCore server — startup, configuration, providers/SPIs, cross-cutting concerns
    on Nov 17, 2026
  2. added theissue type on Nov 17, 2026
  3. self-assigned this
    on Nov 17, 2026
  4. added 2 commits that reference this issue on Nov 17, 2026
    565b284
    bf0e901
  5. added a commit that references this issue on Nov 17, 2026
    eeceb5a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Fields

No fields configured for bug.

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions