Skip to content

Configuring Keycloak SMTP and email verification

Keycloak can send emails for account verification, password resets, and other notifications. This requires configuring an SMTP server in the Keycloak admin console.

Setting up the SMTP server

  1. Log in to the Keycloak admin console and select your application realm

  2. Navigate to Realm settingsEmail

  3. Fill in the SMTP server details:

Field Description
From The sender email address (e.g. no-reply@example.com)
Host SMTP server hostname
Port SMTP port (typically 587 for STARTTLS, 465 for SSL)
Encryption Enable StartTLS or SSL/TLS as required by your server
Authentication Enable and provide credentials if your server requires them
  1. Click Test connection to verify the configuration, then Save

See the Keycloak email configuration documentation for the full list of options.

Requiring email verification

Once SMTP is configured, you can require new users to verify their email address before they can log in:

  1. Navigate to Realm settingsLogin

  2. Enable Verify email

  3. Click Save

From this point on, newly registered users will receive a verification email and must click the link before their account becomes active. Existing users can be sent a verification request manually from Users → select a user → ActionsSend verify email.

Refer to the Keycloak login settings documentation for additional options such as requiring email as username.

Making email required in the user profile

You can enforce that users always provide an email address by marking it as required in the user profile schema:

  1. Navigate to Realm settingsUser profile

  2. Click on the email attribute to edit it

  3. Under Required field, enable Always (or scope it to specific roles if needed)

  4. Click Save

With this setting, users cannot complete registration or profile updates without supplying an email address. Combined with the Verify email login setting above, this ensures every active account has a confirmed email address.

See the Keycloak user profile documentation for further details on attribute constraints and validation rules.