Closed Jericho closed 7 years ago
What should we use for field delimiters?
[firstname]
)*|firstname|*
)-firstname-
, %firstname%
or <%firstname%>
){{ firstname }}
)I think we should at least support CakeMail's delimiters in order to be consistent with bulk emails but it would be nice to follow SendGrid's lead and allow any delimiter to be used.
What syntax should we use to define fallback values? (fallback is used when no value is specified for a given merge field.
Dear [firstname, friend]
Dear [firstname, fallback=friend]
I think supporting CakeMail syntax should be good enough.
Other idea: instead of defining our own syntax for delimiters, fallback values, etc. why not simply use Shopify's open-source template language which would allow us to use existing nuget packages such as dotLiquit for merging data and content.
How should we allow a format for numeric and date values to be specified?
[DATE|0|Y-m-d]
)*|DATE:d/m/y|*
{{ article.published_at | date: "%Y" }}
For field delimiters, I say it should be CakeMail's format. Keep it consistent. The same should be done for the fallback values.
Fair enough. Here's what I propose:
mergeData
to the SendWithTrackingAsync
and SendWithoutTrackingAsync
methodsIDictionary<string, object>
firstname
for exampleobject
for data type is so we can support string, numeric and datesstring.empty
I'm completing testing. You will be able to:
int
, long
, float
, etc.), specify a default value and/or specify a format. We support .NET standard numeric formats and custom numeric formatsDATE
, TODAY
or NOW
interchangeably).Here are just a few examples that we support:
String field: [firstname]
, [firstname,friend]
Date field: [customer_since]
, [customer_since | yyyy-MM-dd]
, [customer_since,yesterday | yyyy-MM-dd]
Numeric field: [miles_driven]
, [miles_driven | #,#]
, [miles_driven, 0 | #,#]
Current date and time with default format: [DATE]
, [TODAY]
, [NOW]
Current date and time with custom format: [DATE | yyyy-MM-dd]
, [TODAY | yyyy-MM-dd]
, [NOW | yyyy-MM-dd]
This is a feature they offer when sending mailings (AKA bulk emails), but not when sending relays (AKA transact emails). The library should parse the HTML content, the text content and also the subject line and merge data like "Dear [firstname]" for example.