Jericho / CakeMail.RestClient

.NET wrapper for the CakeMail API
MIT License
9 stars 3 forks source link

Merge fields when sending relays #33

Closed Jericho closed 7 years ago

Jericho commented 7 years ago

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.

Jericho commented 7 years ago

What should we use for field delimiters?

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.

Jericho commented 7 years ago

What syntax should we use to define fallback values? (fallback is used when no value is specified for a given merge field.

I think supporting CakeMail syntax should be good enough.

Jericho commented 7 years ago

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.

Jericho commented 7 years ago

How should we allow a format for numeric and date values to be specified?

beriniwlew commented 7 years ago

For field delimiters, I say it should be CakeMail's format. Keep it consistent. The same should be done for the fallback values.

Jericho commented 7 years ago

Fair enough. Here's what I propose:

Jericho commented 7 years ago

I'm completing testing. You will be able to:

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]