-
Notifications
You must be signed in to change notification settings - Fork 1
3. Recipes Examples
George Njeri (Swagfin) edited this page Mar 7, 2026
·
1 revision
Subject: Order {{ OrderNo }} Confirmed
Hi {{ Customer.FullName:titlecase }},
Order Date: {{ OrderDate:yyyy-MM-dd }}
Payment Status: {{ #if(IsPaid == true) }}PAID{{ #else }}UNPAID{{ #endif }}
Items:
{{ #foreach(Items) }}
- {{ Quantity }} x {{ Name }} = {{ LineTotal:N2 }}
{{ #endforeach }}
Total: {{ Total:N2 }}
{{ #if(CampaignVariant == A) }}Special offer for {{ Customer.FullName:titlecase }}{{ #else }}Do not miss out {{ Customer.FullName:titlecase }}{{ #endif }}
Compliance: {{ #if(Meta.Channel == EMAIL) }}Unsubscribe via {{ Meta.UnsubscribeUrl }}{{ #else }}Reply STOP to unsubscribe{{ #endif }}
Paid: {{ PaidAmount:N2 }}
Credit Limit: {{ Customer.CreditLimit:N2 }}
Difference: {{ __calc(PaidAmount - Customer.CreditLimit):N2 }}
Payments Total: {{ __sum(Customer.Payments.Amount):N2 }}
When producing XML templates:
string output = model.Map(template, extra, new TemplateMapperOptions
{
XmlCharEscaping = true
});This safely escapes values like &, <, >, quotes, and apostrophes.
var extra = new Dictionary<string, object>
{
["Meta.Channel"] = "EMAIL",
["Meta.UnsubscribeUrl"] = "https://example.com/unsubscribe/abc"
};Channel: {{ Meta.Channel }}
Unsubscribe: {{ Meta.UnsubscribeUrl }}
{{ #if(Customer.FullName == null) }}Hello Customer{{ #else }}Hello {{ Customer.FullName:titlecase }}{{ #endif }}