public String render ( String templateName , EmailModel emailModel , Map < String , Object > model , Locale locale ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Rendering template [{}] for recipient [{}]" , templateName , emailModel . getTo ( ) ) ; } final IEngineConfiguration engineConfiguration = templateEngineFactory . getTemplateEngine ( ) . getConfiguration ( ) ; final ExpressionContext context = new ExpressionContext ( engineConfiguration , locale ) ; context . setVariable ( ThymeleafEvaluationContext . THYMELEAF_EVALUATION_CONTEXT_CONTEXT_VARIABLE_NAME , new ThymeleafEvaluationContext ( applicationContext , null ) ) ; context . setVariables ( model ) ; context . setVariable ( THYMELEAF_EMAIL_MODEL_NAME , emailModel ) ; return templateEngineFactory . getTemplateEngine ( ) . process ( templateName , context ) ; }
renders a template and returns its output