Repository navigation
Replies: 1 comment
|
Agreed. I think it makes sense to better decouple creating email content and sending emails. That would also make it easier to delegate templating to advanced email services (such as Mailjet). We currently do that, but the implementation was a bit intricate. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hello Keycloak team and users!
I see that the Keycloak team has started refactoring the DefaultEmailSenderProvider to allow for authentication with other mechanisms with #36665. But this doesn't address the requests for greater control over the content of the e-mails.
Currently the DefaultEmailSenderProvider is being used by the FreeMarker e-mail templates to send the text+html e-mails. The administrator has no control of the e-mails besides what is allowed by the e-mail templates. They can send localized e-mails, e-mails with remote links, remote images (stored on Keycloak theme, or elsewhere), even trigger custom templates from a custom spi.
But Keycloak lacks functionality to attach any kind of files to the e-mails. It cannot sign e-mail messages using a private certificate. It cannot encapsulate a PGP signature or encrypt a message. It cannot bcc to a recipient and much more. There are many issues that have requested such features.
Of course the DefaultEmailSenderProvider should remain as simple as possible, but in the current implementation I have to completely override it, in order to be able to do any of these tasks. That is because in the provider, the methods that can modify the content of the e-mail and send the e-mail are all private and cannot be called. Maybe they are this way because they were considered to be implementation methods.
My proposal is to keep the public send() methods as simple as possible, break up all the message building methods to individual tasks, and where required change the methods to public or protected (e.g adding a mime part, adding the headers etc.)
References:
#26347
#38358
All reactions