Not able to send welcoming email after successful registration

I am working on Keycloak theme. Where we need to send Welcoming Email After Successfully registration.

And also we want to send the custom email content in mail.

is there any reference or link present which we can used to achieve our requirements.

Thanking you.

I’ve done a similar thing by implementing an EventListener to trigger on EventType.REGISTER. Then you can send a custom email by getting the EmailTemplateProvider from the session, and rendering a custom .ftl template. For example:

  public void onEvent(Event event) {
    if (event.getType() != EventType.REGISTER) return;

    RealmModel realm = session.realms().getRealm(event.getRealmId());
    UserModel user = session.users().getUserById(event.getUserId(), realm);

    try {
      EmailTemplateProvider emailTemplateProvider =
      List<Object> subjectAttr = new ArrayList();
      Map<String, Object> bodyAttr =new HashMap();
      bodyAttr.put("realmName", realm.getName());
          .setAttribute("realmName", realm.getName())
    } catch (EmailException e) {
      log.error("Failed to send welcome mail", e);

I am new in keycloak and also in maven for building jar plugins.

can you provide me exact steps to achieve this requirement

Thanking You.

There are several example projects with Keycloak event listeners and email themes. Search for some of those, and then post any specific questions you have if you get stuck.


Is there a way to change email template contents from the keycloak UI instead of setting it from themes.
And we’re including the welcome email content into that verification mail only.
from where we can manage that email verification expiry time from keycloak

Thanking You.

No. Currently, you have to do it as a theme.