Hello everyone,
I know the default behavior of sending email in Keycloak will always trigger with email attribute from User which makes sence. On the other hand, i have business case where the email field is used for different purposes and we would like to send email to another field value like custom attribute for email sending
I read the code of org.keycloak.email.freemarker.FreeMarkerEmailTemplateProvider#send(java.lang.String, java.util.List<java.lang.Object>, java.lang.String, java.util.Map<java.lang.String,java.lang.Object>) and the method does not allow to pass in address.
I looked at protected method org.keycloak.email.freemarker.FreeMarkerEmailTemplateProvider#send(java.util.Map<java.lang.String,java.lang.String>, java.lang.String, java.lang.String, java.lang.String, java.lang.String) and I can see you can pass in address as the last attribute.
I have options either i have to clone UserModel and set email attribute directly because setting email attribute to the same userModel will trigger update email attribute of User which we don’t want.
Inherit org.keycloak.email.freemarker.FreeMarkerEmailTemplateProvider which I do not know how to register the implement in Keycloak.
Thanks a lot for any hints,
Tuan Do