/// <summary> /// Fills the form answers. /// </summary> /// <param name="email">The email.</param> /// <param name="model">The model.</param> /// <param name="formAnswer">The form answer.</param> private static void FillFormAnswers(MailTemplate email, FormBuilderWidget model, FormWidgetAnswer formAnswer) { email.AppendParam("Title", model.Title); email.AppendParam("Date", formAnswer.CreateDate.ToString()); if (formAnswer.AnswerValues == null) { return; } var path = Path.Combine(FormsPlugin.Instance.PluginDirectory + FormsTemplatesDirectory, FormsAnswerValueTemplate); if (File.Exists(path)) { using (var streamTemplate = new StreamReader(File.OpenRead(path), Encoding.UTF8)) { var template = streamTemplate.ReadToEnd(); //render form answer var answer = new StringBuilder(); foreach (var item in formAnswer.AnswerValues) { answer.Append(template.Replace("<#AnswerValue#>", String.Format("{0}: {1}", item.Field, item.Value))); } email.AppendParam("Content", answer.ToString(), false); } } }