<div dir="ltr">Thanks Bruno. I got this working with SendGrid. The issue was with the SPI provider registration.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 27, 2016 at 8:53 PM, Bruno Oliveira <span dir="ltr"><<a href="mailto:bruno@abstractj.org" target="_blank">bruno@abstractj.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Maybe you can get some ideas from DefaultEmailSenderProvider[1]?<br>
<br>
[1] - <a href="https://github.com/keycloak/keycloak/blob/master/services/src/main/java/org/keycloak/email/DefaultEmailSenderProvider.java" rel="noreferrer" target="_blank">https://github.com/keycloak/keycloak/blob/master/services/src/main/java/org/keycloak/email/DefaultEmailSenderProvider.java</a><br>
<div><div class="h5"><br>
On 2016-07-25, Vineet Reynolds wrote:<br>
> Hi everybody,<br>
><br>
> Has anyone managed to configure Keycloak 2.0.0.Final to use a<br>
> transactional email API instead of configuring an SMTP server? I would<br>
> prefer to have Keycloak send emails using a rest API like Sendgrid,<br>
> Mandrill, Mailgun or Amazon SES (the cloud-native way) instead of running<br>
> an SMTP server.<br>
><br>
> I'd also appreciate if this is possible through the SPI providers.<br>
><br>
> * Should I implement both EmailSenderProvider and EmailTemplateProvider<br>
> SPIs ?<br>
> * I cannot get my custom EmailSenderProvider SPI implementation to work,<br>
> as the FreemarkerEmailTemplateProvider implementation fails to obtain the<br>
> implementation of the EmailSenderProvider. Stack trace is below<br>
><br>
> 13:17:53,991 ERROR<br>
> [org.keycloak.forms.login.freemarker.FreeMarkerLoginFormsProvider] (default<br>
> task-39) Failed to send verification email:<br>
> org.keycloak.email.EmailException: Failed to template email<br>
> at<br>
> org.keycloak.email.freemarker.FreeMarkerEmailTemplateProvider.send(FreeMarkerEmailTemplateProvider.java:179)<br>
> at<br>
> org.keycloak.email.freemarker.FreeMarkerEmailTemplateProvider.send(FreeMarkerEmailTemplateProvider.java:150)<br>
> at<br>
> org.keycloak.email.freemarker.FreeMarkerEmailTemplateProvider.sendVerifyEmail(FreeMarkerEmailTemplateProvider.java:146)<br>
> at<br>
> org.keycloak.forms.login.freemarker.FreeMarkerLoginFormsProvider.createResponse(FreeMarkerLoginFormsProvider.java:156)<br>
> at<br>
> org.keycloak.authentication.requiredactions.VerifyEmail.requiredActionChallenge(VerifyEmail.java:73)<br>
> at<br>
> org.keycloak.services.managers.AuthenticationManager.executionActions(AuthenticationManager.java:559)<br>
> at<br>
> org.keycloak.services.managers.AuthenticationManager.actionRequired(AuthenticationManager.java:490)<br>
> at<br>
> org.keycloak.services.managers.AuthenticationManager.nextActionAfterAuthentication(AuthenticationManager.java:412)<br>
> at<br>
> org.keycloak.services.resources.LoginActionsService$Checks.verifyRequiredAction(LoginActionsService.java:299)<br>
> at<br>
> org.keycloak.services.resources.LoginActionsService.processRequireAction(LoginActionsService.java:853)<br>
> at<br>
> org.keycloak.services.resources.LoginActionsService.requiredActionGET(LoginActionsService.java:846)<br>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br>
> at<br>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)<br>
> at<br>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)<br>
> at java.lang.reflect.Method.invoke(Method.java:498)<br>
> at<br>
> org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)<br>
> at<br>
> org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)<br>
> at<br>
> org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)<br>
> at<br>
> org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:138)<br>
> at<br>
> org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:101)<br>
> at<br>
> org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)<br>
> at<br>
> org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)<br>
> at<br>
> org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)<br>
> at<br>
> org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)<br>
> at<br>
> org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)<br>
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)<br>
> at<br>
> io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)<br>
> at<br>
> io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)<br>
> at<br>
> org.keycloak.services.filters.KeycloakSessionServletFilter.doFilter(KeycloakSessionServletFilter.java:90)<br>
> at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)<br>
> at<br>
> io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)<br>
> at<br>
> io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)<br>
> at<br>
> io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)<br>
> at<br>
> io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)<br>
> at<br>
> org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)<br>
> at<br>
> io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)<br>
> at<br>
> io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)<br>
> at<br>
> io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)<br>
> at<br>
> io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)<br>
> at<br>
> io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)<br>
> at<br>
> io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)<br>
> at<br>
> io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)<br>
> at<br>
> io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)<br>
> at<br>
> io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)<br>
> at<br>
> io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)<br>
> at<br>
> io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)<br>
> at<br>
> org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)<br>
> at<br>
> io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)<br>
> at<br>
> io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)<br>
> at<br>
> io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)<br>
> at<br>
> io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)<br>
> at<br>
> io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)<br>
> at<br>
> io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)<br>
> at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)<br>
> at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)<br>
> at<br>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)<br>
> at<br>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)<br>
> at java.lang.Thread.run(Thread.java:745)<br>
> Caused by: java.lang.NullPointerException<br>
> at<br>
> org.keycloak.email.freemarker.FreeMarkerEmailTemplateProvider.send(FreeMarkerEmailTemplateProvider.java:185)<br>
> at<br>
> org.keycloak.email.freemarker.FreeMarkerEmailTemplateProvider.send(FreeMarkerEmailTemplateProvider.java:177)<br>
> ... 57 more<br>
><br>
><br>
><br>
> Thanks,<br>
> Vineet<br>
<br>
</div></div>> _______________________________________________<br>
> keycloak-user mailing list<br>
> <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br>
<br>
<br>
--<br>
<br>
abstractj<br>
PGP: 0x84DC9914<br>
</blockquote></div><br></div>