Ejemplo n.º 1
0
        private string GetHtmlEmailContent(Page page, IList <FormElementFieldValue> fieldValues)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("<html>");
            sb.AppendLine("<head>");
            sb.AppendLine("<style>");
            sb.AppendLine("h1 { margin: 20px 0 10px 0; padding: 0; font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif; font-size: 36px; line-height: 1.1; color: #333333; }");
            sb.AppendLine("h2 { margin: 20px 0 10px 0; padding: 0; font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif; font-size: 30px; line-height: 1.1; color: #333333; }");
            sb.AppendLine("p { margin: 10px 0 10px 0; padding: 0; width: 100%; font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.4; color: #333333; }");
            sb.AppendLine("</style>");
            sb.AppendLine("</head>");
            sb.AppendLine("<body>");
            sb.AppendFormat("<h1>{0}</h1>", _webHelperService.HtmlEncode(string.Format(ElementResource.FormEmailHeading, page.Name)));
            for (int index = 0; index < fieldValues.Count; index++)
            {
                sb.AppendLine("<p>");
                FormElementFieldValue fieldValue = fieldValues[index];
                sb.AppendLine("<strong>" + fieldValue.Label + ":</strong><br>");
                sb.AppendLine(_webHelperService.FormatMultiLine(_webHelperService.HtmlEncode(fieldValue.Value ?? string.Empty)));
                sb.AppendLine("</p>");
            }
            sb.AppendLine("</body>");
            sb.AppendLine("</html>");
            return(sb.ToString());
        }
Ejemplo n.º 2
0
        private string GetPlainTextEmailContent(Page page, IList <FormElementFieldValue> fieldValues)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(string.Format(ElementResource.FormEmailHeading, page.Name));
            sb.AppendLine();
            for (int index = 0; index < fieldValues.Count; index++)
            {
                FormElementFieldValue fieldValue = fieldValues[index];
                sb.AppendLine(fieldValue.Label + ":");
                sb.AppendLine(fieldValue.Value ?? string.Empty);
                if (index != fieldValues.Count - 1)
                {
                    sb.AppendLine();
                }
            }
            return(sb.ToString());
        }