/// <summary> /// Parse the email from template and model /// </summary> /// <typeparam name="TModel"></typeparam> /// <param name="template"></param> /// <param name="model"></param> /// <returns></returns> public EmailTemplateResponseModel ParseEmail <TModel>(EmailTemplate template, TModel model) { if (template == null) { return(null); } var subjectCacheName = template.Type.GetEnumName().GetTemplateCacheName(template.Subject); var bodyCacheName = template.Type.GetEnumName().GetTemplateCacheName(template.Body); var response = new EmailTemplateResponseModel { From = template.From, FromName = template.FromName, CC = MailUtilities.FormatEmailList(template.CC), CCList = MailUtilities.ParseEmailList(template.CC), BCC = MailUtilities.FormatEmailList(template.BCC), BCCList = MailUtilities.ParseEmailList(template.BCC), Subject = EzRazorEngineHelper.CompileAndRun(template.Subject, model, subjectCacheName), Body = EzRazorEngineHelper.CompileAndRun(template.Body, model, bodyCacheName) }; return(response); }