예제 #1
0
        public static string GenerateNotification()
        {
            var productName        = "ABC";
            var productStatus      = "available";
            var productDescription = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis nisl ut tellus egestas facilisis. Nulla eget erat dictum, facilisis libero sit amet, sollicitudin tortor. Morbi iaculis, urna eu tincidunt dapibus, sapien ex dictum nibh, non congue urna tellus vitae risus.";
            var components         = new string[] { "Part A", "Part B" };

            // Format product display.
            var items = components.Select(item => MailBody.CreateBlock().Text(item));

            var body = MailBody
                       .CreateBody()
                       .Paragraph("Hello,")
                       .Paragraph("The product " + productName + " is now " + productStatus + ".")
                       .SubTitle("Here is the product summary:")
                       .Paragraph(MailBody.CreateBlock()
                                  .StrongText("Product name: ").Text(productName))
                       .Paragraph(MailBody.CreateBlock()
                                  .StrongText("Description: ").Text(productDescription))
                       .Paragraph(MailBody.CreateBlock()
                                  .StrongText("Components:"))
                       .UnorderedList(items)
                       .Paragraph("— [Insert company name here]")
                       .ToString();

            return(body);
        }
예제 #2
0
        public static string GenerateCustomThemeAndRawHtml()
        {
            var template = MailBodyTemplate.GetDefaultTemplate();

            template
            .Paragraph(m =>
                       "<p style='" +
                       (m.IsProperty(() => m.Attributes.color) ? $"color:{m.Attributes.color};" : string.Empty) +
                       (m.IsProperty(() => m.Attributes.backgroundColor) ? $"background-color:{m.Attributes.backgroundColor};" : string.Empty) +
                       $"'>{m.Content}</p>")
            .Body(m => "<html><body>" + m.Content + "<br />" + m.Footer + "</body></html>")
            .Text(m =>
                  $"<span style='" +
                  (m.IsProperty(() => m.Attributes.color) ? $"color:{m.Attributes.color};" : string.Empty) +
                  (m.IsProperty(() => m.Attributes.backgroundColor) ? $"background-color:{m.Attributes.backgroundColor};" : string.Empty) +
                  (m.IsProperty(() => m.Attributes.fontWeight) ? $"font-weight:{m.Attributes.fontWeight};" : string.Empty) +
                  $"'>{m.Content}</span>");

            var footer = MailBody
                         .CreateBlock()
                         .Text("Follow ", new { color = "red" })
                         .Link("http://twitter.com/example", "@Example")
                         .Text(" on Twitter.", new { color = "#009900", backgroundColor = "#CCCCCC", fontWeight = "bold" });

            var body = MailBody
                       .CreateBody(template, footer)
                       .Paragraph("Please confirm your email address by clicking the link below.")
                       .Raw("<p>We may need to send you <strong>critical information</strong> about our service and it is important that we have an accurate email address.</p>")
                       .Button("https://www.example.com/", "Confirm Email Address")
                       .Paragraph("— [Insert company name here]", new { color = "white", backgroundColor = "black" })
                       .ToString();

            return(body);
        }
        private string ReplyCommentEmailTemplate(EmailOptions options)
        {
            var footer = MailBody
                         .CreateBlock()
                         .Text("Follow us at ")
                         .Link("https://github.com/Awesome-CMS-Core/Awesome-CMS-Core", "@github");

            var body = MailBody
                       .CreateBody(footer)
                       .Paragraph($"Dear {options.UserComment}")
                       .Paragraph($"User {options.UserReply} just reply your commant at")
                       .Button($"{options.Url}", "Follow this link to the post")
                       .Paragraph("— Awesome CMS Core support team")
                       .ToString();

            return(body);
        }
예제 #4
0
        public static string GenerateWithfooter()
        {
            var footer = MailBody
                         .CreateBlock()
                         .Text("Follow ")
                         .Link("http://twitter.com/example", "@Example")
                         .Text(" on Twitter.");

            var body = MailBody
                       .CreateBody(footer)
                       .Paragraph("Please confirm your email address by clicking the link below.")
                       .Paragraph("We may need to send you critical information about our service and it is important that we have an accurate email address.")
                       .Button("https://www.example.com/", "Confirm Email Address")
                       .Paragraph("— [Insert company name here]")
                       .ToString();

            return(body);
        }
예제 #5
0
        public static string GenerateBlocks()
        {
            var componentsArray = new string[] { "Block A", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis nisl ut tellus egestas facilisis. Nulla eget erat dictum, facilisis libero sit amet, sollicitudin tortor. Morbi iaculis, urna eu tincidunt dapibus, sapien ex dictum nibh, non congue urna tellus vitae risus." };
            var buttonsArray    = new Tuple <string, string>[] { Tuple.Create <string, string>("http://www.google.com", "Button A"), Tuple.Create <string, string>("http://www.disney.com", "Button B") };

            var items   = componentsArray.Select(item => MailBody.CreateBlock().Paragraph(item));
            var buttons = buttonsArray.Select(item => MailBody.CreateBlock().Button(item.Item1, item.Item2));

            var body = MailBody
                       .CreateBody()
                       .Paragraph("Hello,")
                       .SubTitle("Here is the blocks:")
                       .AddBlocksList(items)
                       .AddBlocksList(buttons)
                       .Paragraph("— [Insert company name here]")
                       .ToString();

            return(body);
        }
예제 #6
0
        public static string GenerateOrderConfirmation()
        {
            var products = new string[] { "1 x Product A", "2 x Product B", "3 x Product C" };

            // Format product display.
            var items = products.Select(item => MailBody.CreateBlock().Text(item));

            var body = MailBody
                       .CreateBody()
                       .Title("Confirmation of your order")
                       .Paragraph("Hello,")
                       .Paragraph("We confirm having received your order.")
                       .Paragraph("Here is the list of ordered items:")
                       .UnorderedList(items)
                       .Paragraph("Thank you for ordering from us!")
                       .Paragraph("— [Insert company name here]")
                       .ToString();

            return(body);
        }
        private string AccountCreationConfirm(EmailOptions options)
        {
            var emailInfo = new[] {
                $"UserName: {options.UserName}",
                $"Password: {options.Password}"
            };

            var emailInfoFormat = emailInfo.Select(item => MailBody.CreateBlock().Text(item));

            var body = MailBody
                       .CreateBody()
                       .Paragraph($"Hi {options.UserName} Please confirm your email address by clicking the link below.")
                       .Paragraph("Here is your login information")
                       .UnorderedList(emailInfoFormat)
                       .Paragraph("Please change it after you login")
                       .Button($"{options.Url}", "Confirm Email Address")
                       .Paragraph("— [Awesome CMS Core]")
                       .ToString();

            return(body);
        }
예제 #8
0
        public static string GenerateCustomThemeAndRawHtml()
        {
            var footer = MailBody
                         .CreateBlock()
                         .Text("Follow ")
                         .Link("http://twitter.com/example", "@Example")
                         .Text(" on Twitter.");

            var template = MailBodyTemplate.GetDefaultTemplate();

            template.Paragraph = "<p style='color:blue;'>{0}</p>";

            var body = MailBody
                       .CreateBody(template, footer)
                       .Paragraph("Please confirm your email address by clicking the link below.")
                       .Raw("<p>We may need to send you <strong>critical information</strong> about our service and it is important that we have an accurate email address.</p>")
                       .Button("https://www.example.com/", "Confirm Email Address")
                       .Paragraph("— [Insert company name here]")
                       .ToString();

            return(body);
        }