How to add cc and bcc fields when an email is sent from keycloak?


I found out that Keycloak can’t send emails to cc and bcc. Does somebody have already checked out the possibility to have this kind of feature? I suppose such as a custom feature by means of some SPI

You can’t do this with the standard Keycloak. The EmailSenderProvider takes just a user and uses their email for the “to” field. You would have to override that provider and probably the EmailTemplateProvider that calls it in order to have “cc” and “bcc” fields added.

That could be the way but override what does it mean from a functional point of view? Is there is something to set up after having extended the default provider behavior?

You need to make those functional choices in the process of implementing those providers. In which cases do you want to send emails to “cc” and “bcc”? Where will those email addresses come from? Laying out the concrete use case will help you as you go to implement the custom providers.

1 Like