Beispiel #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());
        }
Beispiel #2
0
        public string GetQuoteMessage(string message, string alias)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat(BlockquoteText + ElementResource.ForumQuoteBegin, _webHelperService.HtmlEncode(alias));
            sb.AppendLine();
            sb.AppendLine(BlockquoteText);
            message = message.Trim();
            using (StringReader sr = new StringReader(message))
            {
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    sb.AppendLine(BlockquoteText + line.Trim());
                }
            }
            return(sb.ToString());
        }