# How to access OIDC client information in E-Mail templates?

**URL:** https://forum.keycloak.org/t/how-to-access-oidc-client-information-in-e-mail-templates/12722
**Category:** Miscellanaeous
**Created:** [December 21, 2021, 11:13am UTC](https://forum.keycloak.org/t/how-to-access-oidc-client-information-in-e-mail-templates/12722 "2021-12-21T11:13:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![schuerg](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/schuerg/32/4351_2.png) [@schuerg](https://forum.keycloak.org/u/schuerg)
#### Post date: [December 21, 2021, 11:13am UTC](https://forum.keycloak.org/t/how-to-access-oidc-client-information-in-e-mail-templates/12722/1 "2021-12-21T11:13:06Z")

</div>

I know how to access some variable information in Keycloak E-Mail templates. E.g.:

```auto
user.getUsername()
user.getEmail()
user.getFirstName()
user.getLastName()

```

But I need to access client specific variables. The Keycloak Java Code shows there is all information I need in the `ClientModel` Java Class: [https://github.com/keycloak/keycloak/blob/main/server-spi/src/main/java/org/keycloak/models/ClientModel.java](https://github.com/keycloak/keycloak/blob/main/server-spi/src/main/java/org/keycloak/models/ClientModel.java)

```auto
client.getClientId()
client.getName()
client.getDescription()
client.getRootUrl()
client.getBaseUrl()
client.getAttribute(name)

```

And the `client_id=account` Query Parameter is also set on the page, where the password reset action is triggered:

`https://example.com/auth/realms/my-realm/login-actions/reset-credentials?client_id=account&tab_id=bQiVx012SZg`

![image](https://global.discourse-cdn.com/free1/uploads/keycloak/original/2X/8/8af446b4bff5fd329790ecf8e62e816405442f50.png)

The information is set on the client:

![image](https://global.discourse-cdn.com/free1/uploads/keycloak/original/2X/2/2c6695f78c5504f08b341f8ba3d55ef69eb7fef2.png)

But the client varaible seems to be unset while the email template gets rendered.

 ![image](https://global.discourse-cdn.com/free1/uploads/keycloak/original/2X/2/207aa29232916d3eb1fd9fa07ddb78df6009586e.png)

```auto
# password-reset.ftl

# This does NOT work
${client.name}

# This does NOT work
${kcSanitize(msg("clientinfohtml",client.getName()))?no_esc}

```

**How to access client variables in Keycloak E-Mail templates?**

---

<div class="post-metadata">

### Author: ![dasniko](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/dasniko/32/2969_2.png) [@dasniko](https://forum.keycloak.org/u/dasniko)
#### Post date: [December 21, 2021, 11:39am UTC](https://forum.keycloak.org/t/how-to-access-oidc-client-information-in-e-mail-templates/12722/2 "2021-12-21T11:39:35Z")

</div>

The defaults are implemented in the `FreeMarkerEmailTemplateProvider`. If this isn’t enough for you, you’ll have to implement your own custom `EmailTemplateProvider` (with according factory class of course) and register it properly.
