+2 votes

If you have a class with a property of a List(Of String), how does the [foreach] work with outputting the values into the mail?

Class MyClass
Public Property MyValues as List(of String)

In Template :

<ul>
[foreach MyValues]
   <li>[what_goes_here]</li>
[end]
</ul>

Additionally - in a forwarded mail, using a template, how do you refer to [QuotedHtml] as this isn't a property of your object? I want to put information before and after the quoted original mail.

by
edited

1 Answer

0 votes

Use property names of the objects that are in your collection.

Or [this] if you want the object itself to be displayed.

QuotedHtml is a property of the object, that is passed to the reply/forward builder template. You can use TemplateKeys property to include additional key/value pairs in the template.

ReplyBuilder replyBuilder = new ReplyBuilder(original);
replyBuilder.TemplateKeys.Add("XYZ", "abcd");

replyBuilder.TextReplyTemplate = @"[Text] template text [XYZ] [QuoteText]";
replyBuilder.HtmlReplyTemplate = @"[Html] template html [XYZ] [QuoteHtml]";

replyBuilder.Html = "reply-html";
replyBuilder.Text = "reply-text";

MailBuilder builder = replyBuilder.Reply(new MailBox("bob@example.com"));

IMail mail = builder.Create();
Assert.AreEqual("abcd", mail.Subject);
Assert.AreEqual("reply-text template-text abcd > original-text.", mail.Text);
Assert.AreEqual("reply-html template-html abcd \r\n    original-text.\r\n    ", mail.Html);
by (301k points)
edited by
...